Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-05-16 04:56:21 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-16 04:56:21 +0300
commitdd602579303f5bffb1a8022c5e6aaf8b48cb13ed (patch)
tree1e20ba38fac056b11bcf4bb17dff403ab42fbc1f /lib
parent7cbddf752ad9191c70cac5544cc2d22d2bc7d5eb (diff)
handle file.getBuffer errors
Diffstat (limited to 'lib')
-rw-r--r--lib/storage.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/storage.js b/lib/storage.js
index 551c03b..a234365 100644
--- a/lib/storage.js
+++ b/lib/storage.js
@@ -286,11 +286,11 @@ File.prototype.getBlobURL = function (cb) {
}
/**
- * TODO: detect errors and call callback with error
* @param {function} cb
*/
File.prototype.getBuffer = function (cb) {
var self = this
+ cb = once(cb)
var buf = new Buffer(self.length)
var start = 0
self.createReadStream()
@@ -301,6 +301,7 @@ File.prototype.getBuffer = function (cb) {
.on('end', function () {
cb(null, buf)
})
+ .on('error', cb)
}
File.prototype._checkDone = function () {