Here we show some import code for Load Larger size file uzing http request.
when you need to load large file in blob type.
it's Solution For Auto Select File in Select input type.
Load Your File in Blob Type.
Following is Code.
Easy Wayt To Load any File in Blob. same As Select file.
Thanks.
when you need to load large file in blob type.
it's Solution For Auto Select File in Select input type.
Load Your File in Blob Type.
Following is Code.
function loadXHR(url) {
console.log("Load Function Called..");
return new Promise(function(resolve, reject) {
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "blob";
xhr.onerror = function() {reject("Network error.")};
xhr.onload = function() {
if (xhr.status === 200) {
console.log("Responce done....");
resolve(xhr.response)
}else {
console.log("Error....",xhr.statusText);
reject("Loading error:" + xhr.statusText)
}
};
xhr.send();
}
catch(err) {
reject(err.message)
}
});
}
let urlOfEDF = 'PATH_OF_YOUR_FILE';
loadXHR(urlOfEDF).then(function(FILE_BLOB) {
var edfReader = new FileReader();
edfReader.onload = function(event){
// Here You get Your File in Blob Data
console.log('Done Loading...',FILE_BLOB);
};
edfReader.readAsText(FILE_BLOB);
});
Easy Wayt To Load any File in Blob. same As Select file.
Thanks.
Comments
Post a Comment