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>2019-08-09 23:40:41 +0300
committerFeross Aboukhadijeh <feross@feross.org>2019-08-09 23:40:41 +0300
commite583bd785447c2e811811414083b8ca0683dc343 (patch)
tree764c428390b33b37119bfc859fae8dce9d9fe97f /lib
parent459267e1cabfbe257a78f2693af9dcb537745833 (diff)
Fixes for stream-to-blob-url@3
Diffstat (limited to 'lib')
-rw-r--r--lib/file.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/file.js b/lib/file.js
index 993e06a..381ae5c 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -105,12 +105,19 @@ class File extends EventEmitter {
getBlob (cb) {
if (typeof window === 'undefined') throw new Error('browser-only method')
streamToBlob(this.createReadStream(), this._getMimeType())
- .then(blob => cb(null, blob), cb)
+ .then(
+ blob => cb(null, blob),
+ err => cb(err)
+ )
}
getBlobURL (cb) {
if (typeof window === 'undefined') throw new Error('browser-only method')
- streamToBlobURL(this.createReadStream(), this._getMimeType(), cb)
+ streamToBlobURL(this.createReadStream(), this._getMimeType())
+ .then(
+ blobUrl => cb(null, blobUrl),
+ err => cb(err)
+ )
}
appendTo (elem, opts, cb) {