write-file-bluebird
promise wrapper for node’s fs.writeFile().
wraps node’s fs.writeFile()
, in a bluebird promise that resolves with true
if successful, or rejects with the Error
returned by fs.writeFile()
; both results need to be handled by the code calling this function.
table of contents
installation
npm install write-file-bluebird
usage
writeFile( file, data[, options] )
@param string|buffer|number file filename or file descriptor @param string|buffer data @param object|string options @param string|null optionsencoding = 'utf-8' @param number optionsmode = 0o666 @param string optionsflag = 'w' @returns Promise
default
var data = JSON;var writeFile = ; ;
using node’s path module
the path __dirname/test
must exist in order to create the file test.json
in it
var path = ;var data = JSON;var writeFile = ;var file = path; ;