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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-05-23 09:51:33 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-23 09:51:33 +0300
commitdcff438108c9f5d0d75ad225db55c4dbedb14293 (patch)
tree58df1985b6638b77569dcda80198143678392633
parent658bf783880302379fe556850e94e77da6676389 (diff)
optional mimetype param to getBlobURL
-rw-r--r--lib/storage.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/storage.js b/lib/storage.js
index 04f5b57..3d9f50b 100644
--- a/lib/storage.js
+++ b/lib/storage.js
@@ -275,13 +275,16 @@ File.prototype.createReadStream = function (opts) {
* the future.
* @param {function} cb
*/
-File.prototype.getBlobURL = function (cb) {
+File.prototype.getBlobURL = function (cb, mimetype) {
var self = this
if (typeof window === 'undefined') throw new Error('browser-only method')
self.getBuffer(function (err, buffer) {
if (err) return cb(err)
- var url = window.URL.createObjectURL(new window.Blob([ buffer ]))
+ var blob = mimetype
+ ? new window.Blob([ buffer ], { type: mimetype })
+ : new window.Blob([ buffer ])
+ var url = window.URL.createObjectURL(blob)
cb(null, url)
})
}