Skip to content
Browse files

Create a WriteStream instead of emitting an error when calling `filed…

…("non-existing-file")`. Beware this will stick to documentation, but it will create a file (as `fs.createWriteStream` does).

REFS #8
  • Loading branch information...
1 parent e1bfe58 commit fbf5b5f323192f9329e3a022cbde4ee5f8b77f8e @naholyr naholyr committed Oct 30, 2011
Showing with 1 addition and 0 deletions.
  1. +1 −0 main.js
View
1 main.js
@@ -43,6 +43,7 @@ function File (options) {
fs.stat(options.path, function (err, stats) {
var finish = function (err, stats) {
+ if (err && err.code === 'ENOENT' && !self.dest && !self.src) self.src = self.path
if (err && !self.dest && !self.src) return self.emit('error', err)
if (err && self.dest && !self.dest.writeHead) return self.emit('error', err)

0 comments on commit fbf5b5f

Please sign in to comment.
Something went wrong with that request. Please try again.