Skip to content

Instantly share code, notes, and snippets.

@wtfil
Last active December 22, 2015 19:59
Show Gist options
  • Save wtfil/6523011 to your computer and use it in GitHub Desktop.
Save wtfil/6523011 to your computer and use it in GitHub Desktop.
ES6 generator usage with co library
var co = require('co'),
fs = require('fs'),
read = co.wrap(fs.readdir);
co(function *(){
var users = yield read('/Users');
console.log(users);
});
@wtfil
Copy link
Author

wtfil commented Sep 11, 2013

run node with --harmony-generators option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment