-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a note in the README whether it is advised to use fs2 or Node promisified methods #20
Comments
Hello @madarche, I use Also it's important to note one limitation in the way how functions are promisified in var readFile = promisify(fs.readFile), writeFile = promisify(writeFile);
writeFile(__filename + '.copy', readFile(__filename)).done(); but following won't: var readFile = fs2.readFile, writeFile = fs2.writeFile
writeFile(__filename + '.copy', readFile(__filename)).done(); // Fail With fs2 functions, you need to do: readFile(__filename)(function (content) {
return writeFile(__filename + '.copy', content);
}).done(); I plan to fix that, and then indeed it'll be good idea to mention it in a doc. |
Thanks very much @medikoo. I'm now following fs2 closely to know when that happens. Cheers! |
Hello,
Happy and grateful user of deferred I have just discovered https://github.com/medikoo/fs2
Is it recommended to use
a) var readFile = require('fs2').readFile;
or
b) var readFile = promisify(fs.readFile, 1);
?
Thanks!
The text was updated successfully, but these errors were encountered: