Closed ericlathrop closed 10 years ago
I haven't done much CoffeeScript, but if I figure out how to fix this, would you accept a pull request?
Oh, I thank you sir :)
I accept pull requests but if you want, you can send me here (to comments) updated javascript and I can rewrite it to coffee script. Comment because if you will make pull request with just js, it will be rewritten by coffee script compiler. Than I will mention you in comment in code and in changelog.
I made some progress on this last night. I got the createReadStream() now emitting the error event instead of throwing an exception. Now I'm working on createWriteStream().
Brilliant. And can I please ask you to create pull request from develop branch?
Sure! I just got createWriteStream's error event working. Expect a pull request soon.
Thanks so much for this wonderful module! It has saved me much time, since I don't have to write something similar.
I bumped into a case where the mock has different behaviour from the real fs package. Normally fs.createReadStream/fs.createWriteStream should never throw errors, but instead emit an error event.
I looked through the code, and saw that it's using openSync which is throwing exceptions: https://github.com/sakren/node-fs-mock/blob/master/lib/fs.js#L1179 https://github.com/sakren/node-fs-mock/blob/master/lib/fs.js#L1215
These exceptions should be caught and transformed into error events.