# prepend-file

> Prepend data to a file, creating it if it doesn't exist.

Latest version **2.0.1** (published 2022-01-11) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-01-11 |
| First published | 2014-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | ^10.17 \|\| >=11.14 |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36 |
| Author | Hemanth.HM |
| Maintainers | stevemao, hemanth, richienb |
| Keywords | fs, file, prepend |

## Links

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

## Dependencies (1)

- [temp-write](https://npm.io/package/temp-write.md) ^4.0.0

## 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

- 2.0.1 (latest) — 2022-01-11
- 2.0.0 — 2020-08-01
- 1.3.1 — 2016-11-26
- 1.3.0 — 2015-05-08
- 1.2.1 — 2015-05-04
- 1.2.0 — 2015-05-04
- 1.1.0 — 2015-04-07
- 1.0.0 — 2015-04-07
- 0.2.0 — 2014-11-22
- 0.1.2 — 2014-06-21
- 0.1.1 — 2014-06-20
- 0.1.0 — 2014-06-20

## README

# prepend-file [![Build Status][travis-image]][travis-url] [![Code Coverage][coveralls-image]][coveralls-url]

> Prepend data to a file, creating it if it doesn't exist.

## Install

```sh
npm install prepend-file
```

## Usage

```js
const prependFile = require('prepend-file');

(async () => {
  await prependFile('message.txt', 'some data');
});
```

## API

### prependFile(filename, data)

### prependFile.sync(filename, data)

#### filename

Type: `string`

The file to prepend the `data` to.

#### data

Type: `string | Buffer`

The data to prepend.

[travis-image]: https://travis-ci.org/hemanth/node-prepend-file.svg?branch=master
[travis-url]: https://travis-ci.org/hemanth/node-prepend-file
[coveralls-image]: https://coveralls.io/repos/hemanth/node-prepend-file/badge.svg
[coveralls-url]: https://coveralls.io/r/hemanth/node-prepend-file

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