npm.io
2.0.1 • Published 4 years ago

prepend-file

Licence
MIT
Version
2.0.1
Deps
1
Size
6 kB
Vulns
0
Weekly
0
Stars
36

prepend-file Build Status Code Coverage

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

Install

npm install prepend-file

Usage

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.

Keywords