empty-file-callback

1.0.0 • Public • Published

empty-file-callback

NPM version Build Status Coverage Status Dependency Status devDependency Status

Callback style version of empty-file

const emptyFileCallback = require('empty-file-callback');
const fs = require('fs');

emptyFileCallback('file/path', err => {
  if (err) {
    throw err;
  }

  fs.readFileSync('file/path', 'utf8'); //=> ''
});

Installation

Use npm.

npm install empty-file-callback

API

const emptyFileCallback = require('empty-file-callback');

emptyFileCallback(filePath [, options], callback)

filePath: String
options: Object (fs.writeFile options except for encoding)
callback: Function

The API is almost the same as fs.writeFile's, execpt for:

  • It only writes new Buffer(0) to the file. The data is unchangable.
  • It doesn't support encoding option.

Related project

License

The Unlicense.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    2
  • 0.0.1
    1
  • 0.0.0
    1

Package Sidebar

Install

npm i empty-file-callback

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn