# glitch-assets-buffer

> Use relative paths to server glitch assets directly without redirects

Latest version **1.1.2** (published 2019-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install glitch-assets-buffer
pnpm add glitch-assets-buffer
yarn add glitch-assets-buffer
bun add glitch-assets-buffer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2019-10-09 |
| First published | 2019-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mattx8y2 |
| Maintainers | mattx8y2 |
| Keywords | glitch, assets |

## Links

- npm: https://www.npmjs.com/package/glitch-assets-buffer
- Repository: https://glitch.com/edit/#!/assets-buffer
- npm.io page: https://npm.io/package/glitch-assets-buffer

## Dependencies (1)

- [express](https://npm.io/package/express.md) ^4.17.1

## Recent versions

- 1.1.2 (latest) — 2019-10-09
- 1.1.1 — 2019-10-09
- 1.1.0 — 2019-10-09
- 1.0.3 — 2019-07-13
- 1.0.2 — 2019-07-13
- 1.0.1 — 2019-07-13
- 1.0.0 — 2019-07-13

## README

# Assets.js via Buffer

A fork of [assets-lib](https://assets-lib.glitch.me/) that uses Buffers instead of redirects to display images at local addresses.

**This utility is made for [glitch.com](https://glitch.com) projects, and shouldn't be used anywhere else**

### In a nutshell

The standard Assets.js automatically redirects your web browser to the actual asset URL when it requested the asset for a website/etc<br>
However, with assets-buffer, the asset is sent over in the body of the response.

### What this means

Navigating to [/assets/foobar.png](https://assets-lib.glitch.me/assets/foobar.png) on the old system redirects you to [https://cdn.hyperdev.com/us-east-1%3A1a0f89c8-26bf-4073-baed-2b409695e959%2Ffoobar.png](https://cdn.hyperdev.com/us-east-1%3A1a0f89c8-26bf-4073-baed-2b409695e959%2Ffoobar.png)<br>
Whereas navigating to [/assets/foobar.png](https://assets-buffer.glitch.me/assets/foobar.png) displays the same image without redirecting you.

## Getting Started

### Install:
Local) Just copy and paste the contents of [assets-buffer.js](https://glitch.com/edit/#!/assets-buffer?path=assets-buffer.js:1:0) into your Glitch project. **Express is required to be installed for assets-buffer.js to work**

NPM) Add this line to your package.json:

```json
{
  "dependencies": {
    "glitch-assets-buffer": "^1.1.2"
  }
}
```

### Example usage:
Then reference that file as follows:
```javascript
// LOCAL
var assets = require("./assets-buffer.js");

// NPM
var assets = require("glitch-assets-buffer");

var express = require("express");

var app = express();
app.use("/assets", assets);
```

---
_Source: https://npm.io/package/glitch-assets-buffer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
