Filesystem.read()

Read a file on disk as a string.

Assumes file contents are encoded using utf8.

Usage

Hover over inputs/exits for more info.

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


// Read a file on disk as a string.

Filesystem.read({

source: '/Users/mikermcneil/.tmp/foo',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No file could be found at the provided `source` path.

doesNotExist: function () {

 

},

// The specified path pointed to a directory.

isDirectory: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

source required

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

'/Users/mikermcneil/.tmp/foo'

Exits

error

An unexpected error occurred.

doesNotExist

No file could be found at the provided `source` path.

isDirectory

The specified path pointed to a directory.

success

OK.

'stuff in a file!'