JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 45960
  • Score
    100M100P100Q165983F
  • License ISC

Promise version of fs.writefile

Package Exports

  • fs-writefile-promise

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 (fs-writefile-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fs-writefile-promise version License

Promise version of fs.writefile:

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

Build Status Downloads Code Climate Coverage Status Dependencies

Install

npm install --save fs-writefile-promise

API

var write = require('fs-writefile-promise')

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 License © Ahmad Nassri