prepend-file
Version:
Prepend data to a file, creating it if it doesn't exist.
43 lines (26 loc) • 892 B
Markdown
# 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