suspend(function*() {
var fileNames = yield fs.readdir('test', suspend.resume());
fileNames.forEach(function(fileName) {
fs.readFile('test/' + fileName, 'utf8', suspend.fork());
});
var files = yield suspend.join();
})();
the fork() and join() are helpful.
Although the "yield resume" close but need to iterate twice
the fork() and join() are helpful.
Although the "yield resume" close but need to iterate twice