LocalMachinepacks.readMachineFile()

Read machine file located at the specified path into a JSON string w/ stringified functions.

Usage

Hover over inputs/exits for more info.

var LocalMachinepacks = require('machinepack-localmachinepacks');


// Read machine file located at the specified path into a JSON string w/ stringified functions.

LocalMachinepacks.readMachineFile({

source: '/Users/mikermcneil/machinepack-foo/machines/bar.js',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No file exists at the specified path

notFound: function () {

 

},

// Could not stringify machine definition into JSON.

couldNotStringify: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

source required

The path to the machine file (if path is not absolute, will be resolved from the current working directory)

'/Users/mikermcneil/machinepack-foo/machines/bar.js'

Exits

error

An unexpected error occurred.

notFound

No file exists at the specified path

couldNotStringify

Could not stringify machine definition into JSON.

success

OK.

'{friendlyName: "Do something", ... }'