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.esm/browser/uriToBlob.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

20 lines
No EOL
508 B
JavaScript

/**
* uriToBlob resolves a URI to a Blob object. This is used for
* React Native to retrieve a file (identified by a file://
* URI) as a blob.
*/
export default function uriToBlob(uri) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function () {
var blob = xhr.response;
resolve(blob);
};
xhr.onerror = function (err) {
reject(err);
};
xhr.open('GET', uri);
xhr.send();
});
}