Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding stats and fixing lazy reader case.

  • Loading branch information...
commit d9aff721e85d59f6aa21b2da0cc38ab2bd801d12 1 parent db514b9
@mikeal mikeal authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 main.js
View
4 main.js
@@ -43,6 +43,7 @@ function File (options) {
fs.stat(options.path, function (err, stats) {
var finish = function (err, stats) {
+ self.stat = 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)
@@ -153,6 +154,7 @@ function File (options) {
self.path = path.join(self.path, self.index)
self.mimetype = mimetypes.lookup(self.path.slice(self.path.lastIndexOf('.')+1))
fs.stat(self.path, finish)
+ return
} else {
finish(err, stats)
}
@@ -163,7 +165,7 @@ function File (options) {
} else if (self.listeners('data').length > 0) {
fs.createReadStream(self.path).pipe(self.dest)
} else {
- throw new Error('Not Implemented, lazy (future) dynamic read/write discovery,')
+ fs.createReadStream(self.path).pipe(self)
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.