Last active
December 22, 2015 19:59
-
-
Save wtfil/6523011 to your computer and use it in GitHub Desktop.
ES6 generator usage with co library
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 co = require('co'), | |
fs = require('fs'), | |
read = co.wrap(fs.readdir); | |
co(function *(){ | |
var users = yield read('/Users'); | |
console.log(users); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run node with
--harmony-generators
option