This repository has been archived on 2026-07-15. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drive/frontend/node_modules/tus-js-client/lib.es5/browser/sources/readAsByteArray.js
Elijah 724d70e58b
Some checks failed
Automated Container Build / build-and-push (push) Failing after 12s
Inital build
2026-05-22 12:29:43 -07:00

26 lines
No EOL
710 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = readAsByteArray;
/**
* readAsByteArray converts a File object to a Uint8Array.
* This function is only used on the Apache Cordova platform.
* See https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/index.html#read-a-file
*/
function readAsByteArray(chunk) {
return new Promise(function (resolve, reject) {
var reader = new FileReader();
reader.onload = function () {
var value = new Uint8Array(reader.result);
resolve({
value: value
});
};
reader.onerror = function (err) {
reject(err);
};
reader.readAsArrayBuffer(chunk);
});
}