Nondeterministic Postrequisite Metaprotocol
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

fs-writefile-promise

3.0.0 • Public • Published

fs-writefile-promise version License Build Status Downloads Coverage Status

Promise version of fs.writefile:

Asynchronously writes data to a file, replacing the file if it already exists.

Install

npm install --prod --save fs-writefile-promise

API

write(filename, data [, options])

filename: String data String or Buffer options: Object Return: Object (Promise)

When it finishes, it will be fulfilled with the file name that was written to.

When it fails, it will be rejected with an error as its first argument.

write('/tmp/foo', 'bar')
  .then(function (filename) {
    console.log(filename) //=> '/tmp/foo'
  })
 
  .catch(function (err) {
    console.error(err)
  })
})

options

The option object will be directly passed to fs.writefile.


License: ISC • Copyright: ahmadnassri.com • Github: @ahmadnassri • Twitter: @ahmadnassri

install

npm i fs-writefile-promise

Downloadsweekly downloads

1,582

version

3.0.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability