Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Getting started with Uploading Large Files...
import utils from './utils';
if (!ArrayBuffer.prototype.slice) {
ArrayBuffer.prototype.slice = function (begin, end) {
let len = this.byteLength;
begin = (begin|0) || 0;
end = end === (void 0) ? len : (end|0);
// Handle negative values.
if (begin < 0) begin = Math.max(begin + len, 0);
if (end < 0) end = Math.max(end + len, 0);
if (len === 0 || begin >= len || begin >= end) {
return new ArrayBuffer(0);
}
let length = Math.min(len - begin, end - begin);
let target = new ArrayBuffer(length);
let targetArray = new Uint8Array(target);
targetArray.set(new Uint8Array(this, begin, length));
return target;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment