Filesystem.writeStream()

Generate a file on the local filesystem using the specified Readable stream for its contents.

Usage

Hover over inputs/exits for more info.

var Filesystem = require('machinepack-fs');


// Generate a file on the local filesystem using the specified Readable stream for its contents.

Filesystem.writeStream({

sourceStream: '===',

destination: '/Users/mikermcneil/.tmp/bar.json',

force: false,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// An existing file / folder was found at the specified path (overwrite by enabling the `force` input).

alreadyExists: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

sourceStream required

The source (Readable) stream whose contents will be pumped to disk.

'==='
destination required

Absolute path for the destination file (if relative path is provided, will resolve path from current working directory).

'/Users/mikermcneil/.tmp/bar.json'
force

Overwrite files or directories which might exist at or within the specified destination path?

false

Exits

error

An unexpected error occurred.

alreadyExists

An existing file / folder was found at the specified path (overwrite by enabling the `force` input).

success

OK.