Skip to content

Commit 096b729

Browse files
committed
remove unused readBinaryData from utils
readBinaryData is no longer used and should not be used anyway, as binary data should not be encoded as text in the first place.
1 parent 4530a74 commit 096b729

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

src/util.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -236,39 +236,6 @@ var util = {
236236
return (mimeType && mimeType.match(/charset=binary/)) || /[\x00-\x08\x0E-\x1F\uFFFD]/.test(content);
237237
},
238238

239-
/**
240-
* Read binary data and return it as ArrayBuffer.
241-
*
242-
* @param {string} content - The data
243-
* @param {string} mimeType - The data's content-type
244-
* @returns {Promise} Resolves with an ArrayBuffer containing the data
245-
*/
246-
readBinaryData (content, mimeType) {
247-
return new Promise((resolve) => {
248-
let blob;
249-
util.globalContext.BlobBuilder = util.globalContext.BlobBuilder || util.globalContext.WebKitBlobBuilder;
250-
if (typeof util.globalContext.BlobBuilder !== 'undefined') {
251-
const bb = new global.BlobBuilder();
252-
bb.append(content);
253-
blob = bb.getBlob(mimeType);
254-
} else {
255-
blob = new Blob([content], { type: mimeType });
256-
}
257-
258-
const reader = new FileReader();
259-
if (typeof reader.addEventListener === 'function') {
260-
reader.addEventListener('loadend', function () {
261-
resolve(reader.result); // reader.result contains the contents of blob as a typed array
262-
});
263-
} else {
264-
reader.onloadend = function() {
265-
resolve(reader.result); // reader.result contains the contents of blob as a typed array
266-
};
267-
}
268-
reader.readAsArrayBuffer(blob);
269-
});
270-
},
271-
272239
/**
273240
* Read data from an ArrayBuffer and return it as a string
274241
* @param {ArrayBuffer} arrayBuffer

test/unit/node-wireclient-suite.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ if (typeof define !== 'function') {
33
}
44
define(['./src/wireclient', './src/remotestorage'], function (WireClient, RemoteStorage) {
55
var suites = [];
6-
var oldReadBinaryData;
76

87
function setup(env, test) {
98
test.assertType(RemoteStorage, 'function');
109
}
1110

1211
function takedown(env, test) {
13-
if (typeof WireClient !== 'undefined') {
14-
WireClient.readBinaryData = oldReadBinaryData;
15-
}
1612
test.done();
1713
}
1814

0 commit comments

Comments
 (0)