Skip to content

Commit 93f6302

Browse files
committed
v5.0.20210201
* [Blob.js] Blob.arrayBuffer() should return a promise that resolves with an ArrayBuffer (Fixes eligrey#78) (@bjornstar) * [test] Add a test for Blob.arrayBuffer (@bjornstar) * [package.json] Update devDependencies: `eslint` & `mocha` (@bjornstar) * [package.json] Add devDependency: `@sindresorhus/is` (@bjornstar)
1 parent f4c1f32 commit 93f6302

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

Blob.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* Blob.js
22
* A Blob, File, FileReader & URL implementation.
3-
* 2019-04-30
3+
* 2020-02-01
44
*
5-
* By Eli Grey, http://eligrey.com
5+
* By Eli Grey, https://eligrey.com
66
* By Jimmy Wärting, https://github.com/jimmywarting
77
* License: MIT
88
* See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md
@@ -375,7 +375,7 @@
375375
}
376376

377377
Blob.prototype.arrayBuffer = function () {
378-
return Promise.resolve(this._buffer);
378+
return Promise.resolve(this._buffer.buffer || this._buffer);
379379
};
380380

381381
Blob.prototype.text = function () {

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# `blob-polyfill` CHANGELOG
22

3+
## v5.0.20210201
4+
* [Blob.js] Blob.arrayBuffer() should return a promise that resolves with an ArrayBuffer (@bjornstar)
5+
* [test] Add a test for Blob.arrayBuffer (@bjornstar)
6+
* [package.json] Update devDependencies: `eslint` & `mocha` (@bjornstar)
7+
* [package.json] Add devDependency: `@sindresorhus/is` (@bjornstar)
8+
39
## v4.0.20200601
410
* [Blob.js] Populate File and FileReader in exports after confirming File is supported (@bjornstar)
511

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2222
OTHER DEALINGS IN THE SOFTWARE.
2323

2424

25-
[1]: http://eligrey.com
25+
[1]: https://eligrey.com

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blob-polyfill",
3-
"version": "4.0.20190430",
3+
"version": "5.0.20210201",
44
"homepage": "https://github.com/bjornstar/blob-polyfill",
55
"authors": [
66
"Eli Grey <[email protected]>"

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blob-polyfill",
3-
"version": "4.0.20200601",
3+
"version": "5.0.20210201",
44
"description": "Blob.js implements the W3C Blob interface in browsers that do not natively support it.",
55
"main": "Blob.js",
66
"scripts": {
@@ -15,14 +15,15 @@
1515
"blob",
1616
"polyfill"
1717
],
18-
"author": "Eli Grey <[email protected]> (http://eligrey.com)",
18+
"author": "Eli Grey <[email protected]> (https://eligrey.com)",
1919
"license": "MIT",
2020
"bugs": {
2121
"url": "https://github.com/bjornstar/blob-polyfill/issues"
2222
},
2323
"homepage": "https://github.com/bjornstar/blob-polyfill",
2424
"devDependencies": {
25-
"eslint": "^7.1.0",
26-
"mocha": "^7.2.0"
25+
"@sindresorhus/is": "^4.0.0",
26+
"eslint": "^7.19.0",
27+
"mocha": "^8.2.1"
2728
}
2829
}

test/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var assert = require("assert");
2+
var is = require("@sindresorhus/is");
3+
24
var BlobPolyfill = require("../Blob.js");
35

46
var Blob = BlobPolyfill.Blob;
@@ -39,6 +41,16 @@ describe("blob-polyfill", function () {
3941
it("Symbol is Blob", function () {
4042
assert.strictEqual(Blob.prototype[Symbol.toStringTag], "Blob");
4143
});
44+
45+
it("Blob.arrayBuffer() returns a promise that resolves with an ArrayBuffer", function () {
46+
var blob = new Blob();
47+
48+
is.assert.promise(blob.arrayBuffer());
49+
50+
return blob.arrayBuffer().then(function (value) {
51+
is.assert.arrayBuffer(value);
52+
});
53+
});
4254
});
4355

4456
describe("File", function () {

0 commit comments

Comments
 (0)