Dojo-style wrappers for NodeJS
Dojo Toolkit style utilities and wrappers for Node.
This package is designed to provide Dojo-style AMD modules to make working with NodeJS more the "Dojo way".
This code is licensed under the "New" BSD License.
$ cpm install setten
$ volo add kitsonk/setten
The unit tests included with the package leverage the Dojo Objective Harness (D.O.H.). In order to leverage
D.O.H. it is assumed that the
dojo package and the
util directory of Dojo which contains the
doh package are
installed as siblings of the
setten package, for example:
This can be changed by modifying the
setten/tests/index.js package map.
The execute the tests, execute the following command from the
$ node tests
This is a wrapper for the NodeJS
fs module, that takes the asynchronous callback calls and converts them into a
dojo/promise Promise based return.
For example, you might have written code like this in "plain" NodeJS:
var fs = require"fs";fsreadFile"/etc/passwd"iferr throw err;console.logdata;;
This could now be rewritten as:
This is a wrapper for the fs-extra module. This takes the extra functions provides by this library and
dojo/promise based return.
This is a utility library used internally within the package. It provides a convenience function that converts
callback functions into a
dojo/promise Promise return. It would work like this:
require"setten/util"var// do something asynccallbackerr info;var pfn = utilasDeferredfn this false;pfn"something"then// async return// handle error;;
The arguments for
|fn||Function||The function whos return should be converted to a Promise.|
|self||Object?||The scope to be used in conjunction with the function. Defaults to |
Because promises can only be fulfilled with a single value, if the callback is called with more than one argument (minus the error argument) then the promise is fulfilled with the supplied arguments as an array, otherwise it just fufills with the single argument it was passed.