blob-url-to-file
v1.0.0
Published
transformation functions of file/blob/base64
Downloads
46
Readme
js-file
transformation functions of file/blob/base64
blobToBase64
const b64Data = await blobToBase64(blob);
urlToBlob
const blob = await urlToBlob(url); // url is a dataUrl, like: 'data:application/json;base64,ewogICJoZWxsbyI6ICJ3b3JsZCIKfQ==';
base64ToBlob
const blob = await base64ToBlob({ b64Data="", contentType="", sliceSize=512, name=""}); // b64Data is required;
fileUrlToUrl(fileUrl)
const fileUrl = 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Falco_peregrinus_-_01.jpg/1920px-Falco_peregrinus_-_01.jpg';
const url = await fileUrlToUrl(fileUrl);
downloadFile(fileUrl, name)
// autodownload
const fileUrl = 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Falco_peregrinus_-_01.jpg/1920px-Falco_peregrinus_-_01.jpg';
downloadFile(fileUrl, name);