diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-05-23 09:51:33 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-05-23 09:51:33 +0300 |
commit | dcff438108c9f5d0d75ad225db55c4dbedb14293 (patch) | |
tree | 58df1985b6638b77569dcda80198143678392633 | |
parent | 658bf783880302379fe556850e94e77da6676389 (diff) |
optional mimetype param to getBlobURL
-rw-r--r-- | lib/storage.js | 7 |
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) }) } |