# file-params

> Module for sending files via express with replaced parameters

Latest version **0.1.4** (published 2020-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-params
pnpm add file-params
yarn add file-params
bun add file-params
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2020-07-23 |
| First published | 2020-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ondrej Lukes |
| Maintainers | ondralukes |
| Keywords | express, file, params |

## Links

- npm: https://www.npmjs.com/package/file-params
- Repository: https://github.com/ondralukes/file-params
- Homepage: https://github.com/ondralukes/file-params#readme
- Issues: https://github.com/ondralukes/file-params/issues
- npm.io page: https://npm.io/package/file-params

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.4 (latest) — 2020-07-23
- 0.1.3 — 2020-07-19
- 0.1.2 — 2020-07-16
- 0.0.2 — 2020-07-14
- 0.0.1 — 2020-07-14
- 0.0.0 — 2020-07-14

## README

# file-params
## Usage
Apply the package as a middleware to your express app
```
const fileParams = require('file-params');
const express = require('express');

const app = express();

app.use(fileParams({
    delimiter: ';'
}));
```
`delimiter` - Optional - Character used to denote params in files

Use the `sendFileParams(filename, params)` function
```
app.get('/', (req, res) => {
    res.sendFileParams('sample-file.html', {
        a: 'Hello',
        b: 'World!',
        space: ' '
    });
});
```

## Sample output
Input file
```
<h1>;a;;space;;b;</h1>
```

Code
```
const fileParams = require('file-params');
const express = require('express');

const app = express();

app.use(fileParams({
    delimiter: ';'
}));

app.get('/', (req, res) => {
    res.sendFileParams('sample-file.html', {
        a: 'Hello',
        b: 'World!',
        space: ' '
    });
});

app.listen(8080);
```

Response
```
<h1>Hello World!</h1>
```

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