Skip to content

Commit

Permalink
v5.0.20210201
Browse files Browse the repository at this point in the history
* [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)
  • Loading branch information
bjornstar committed Feb 3, 2021
1 parent f4c1f32 commit 93f6302
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Blob.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Blob.js
* A Blob, File, FileReader & URL implementation.
* 2019-04-30
* 2020-02-01
*
* By Eli Grey, http://eligrey.com
* By Eli Grey, https://eligrey.com
* By Jimmy Wärting, https://github.com/jimmywarting
* License: MIT
* See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md
Expand Down Expand Up @@ -375,7 +375,7 @@
}

Blob.prototype.arrayBuffer = function () {
return Promise.resolve(this._buffer);
return Promise.resolve(this._buffer.buffer || this._buffer);
};

Blob.prototype.text = function () {
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# `blob-polyfill` CHANGELOG

## v5.0.20210201
* [Blob.js] Blob.arrayBuffer() should return a promise that resolves with an ArrayBuffer (@bjornstar)
* [test] Add a test for Blob.arrayBuffer (@bjornstar)
* [package.json] Update devDependencies: `eslint` & `mocha` (@bjornstar)
* [package.json] Add devDependency: `@sindresorhus/is` (@bjornstar)

## v4.0.20200601
* [Blob.js] Populate File and FileReader in exports after confirming File is supported (@bjornstar)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.


[1]: http://eligrey.com
[1]: https://eligrey.com
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blob-polyfill",
"version": "4.0.20190430",
"version": "5.0.20210201",
"homepage": "https://github.com/bjornstar/blob-polyfill",
"authors": [
"Eli Grey <me@eligrey.com>"
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blob-polyfill",
"version": "4.0.20200601",
"version": "5.0.20210201",
"description": "Blob.js implements the W3C Blob interface in browsers that do not natively support it.",
"main": "Blob.js",
"scripts": {
Expand All @@ -15,14 +15,15 @@
"blob",
"polyfill"
],
"author": "Eli Grey <me@eligrey.com> (http://eligrey.com)",
"author": "Eli Grey <me@eligrey.com> (https://eligrey.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/bjornstar/blob-polyfill/issues"
},
"homepage": "https://github.com/bjornstar/blob-polyfill",
"devDependencies": {
"eslint": "^7.1.0",
"mocha": "^7.2.0"
"@sindresorhus/is": "^4.0.0",
"eslint": "^7.19.0",
"mocha": "^8.2.1"
}
}
12 changes: 12 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var assert = require("assert");
var is = require("@sindresorhus/is");

var BlobPolyfill = require("../Blob.js");

var Blob = BlobPolyfill.Blob;
Expand Down Expand Up @@ -39,6 +41,16 @@ describe("blob-polyfill", function () {
it("Symbol is Blob", function () {
assert.strictEqual(Blob.prototype[Symbol.toStringTag], "Blob");
});

it("Blob.arrayBuffer() returns a promise that resolves with an ArrayBuffer", function () {
var blob = new Blob();

is.assert.promise(blob.arrayBuffer());

return blob.arrayBuffer().then(function (value) {
is.assert.arrayBuffer(value);
});
});
});

describe("File", function () {
Expand Down

0 comments on commit 93f6302

Please sign in to comment.