Filesystem.write()

Generate a file on the local filesystem using the specified utf8 string as 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 utf8 string as its contents.

Filesystem.write({

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

string: 'lots of words, utf8 things you know',

force: ,

}).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

destination required

Path (relative or absolute) to the file to write.

'/Users/mikermcneil/.tmp/bar'
string

The data to write to the file as text (if omitted, will create an empty file).

'lots of words, utf8 things you know'
force

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

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.