JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 43694
  • Score
    100M100P100Q144697F
  • License MIT

Prepend data to a file, creating the file if it not yet exists.

Package Exports

  • prepend-file

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prepend-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM version Build Status Dependency Status

Prepend data to a file, creating the file if it not yet exists.

Install

$ npm install --save prepend-file

Usage

var prependFile = require('prepend-file');

prependFile('message.txt', 'data to prepend', function(err) {
    if (err) {
        // Error
    }

    // Success
    console.log('The "data to prepend" was prepended to file!');
});

API

prependFile(filename, data, [options], callback)

    * filename String
    * data String | Buffer
    * options Object
        encoding String | Null default = 'utf8'
        mode Number default = 438 (aka 0666 in Octal)
    * callback Function

Asynchronously prepend data to a file, creating the file if it not yet exists. data can be a string or a buffer.

prependFile.sync(filename, data, [options])

The synchronous version of prependFile. Returns undefined.

License

MIT © Hemanth.HM