$ node -v
v4.2.6
$ npm install generator-async
> [email protected] postinstall /home/dchester/test/node_modules/generator-async/node_modules/jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js
[email protected] node_modules/generator-async
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])
$ node example.js
<Buffer ...>
Last active
March 26, 2016 23:56
-
-
Save dchester/404d76b2a8543330d227 to your computer and use it in GitHub Desktop.
Example with fs module and async-generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('generator-async'); | |
// load `fs` with async's `require` | |
var fs = async.require('fs'); | |
async.run(function*() { | |
// read a file | |
var passwd = yield fs.readFile('/etc/passwd'); | |
// then read another file | |
var group = yield fs.readFile('/etc/group'); | |
// then spit out the contents of both files | |
console.log(passwd, group); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment