javascript stringify blob

Solutions on MaxInterview for javascript stringify blob by the best coders in the world

showing results for - "javascript stringify blob"
Allison
08 Oct 2018
1const blobToBase64 = (blob) => {
2  return new Promise((resolve) => {
3    const reader = new FileReader();
4    reader.readAsDataURL(blob);
5    reader.onloadend = function () {
6      resolve(reader.result);
7    };
8  });
9};
10
11(async () => {
12  const b64 = await blobToBase64(blob);
13  const jsonString = JSON.stringify({blob: b64});
14  console.log(jsonString);
15})();
16
Angela
29 Nov 2016
1const parsed = JSON.parse(jsonString);
2const blob = await fetch(parsed.blob).then(res => res.blob());
3console.log(blob);
4