Skip to content

GerHobbelt/node-prepend-to-js-file

 
 

Repository files navigation

prepend-file Build Status Code Coverage

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

When the file (to be prepended to) has a 'hash bang' a.k.a. shebang command at the first line, this will be kept intact.

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.

About

Prepend data to a file.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%