Horje
js create object url base64 pdf binary Code Example
js create object url base64 pdf binary
const b64toBlob = (b64Data, contentType='', sliceSize=512) => {
  const byteCharacters = atob(b64Data);
  const byteArrays = [];

  for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
    const slice = byteCharacters.slice(offset, offset + sliceSize);

    const byteNumbers = new Array(slice.length);
    for (let i = 0; i < slice.length; i++) {
      byteNumbers[i] = slice.charCodeAt(i);
    }

    const byteArray = new Uint8Array(byteNumbers);
    byteArrays.push(byteArray);
  }

  const blob = new Blob(byteArrays, {type: contentType});
  return blob;
}

const blob = b64toBlob(b64Data, contentType);
const blobUrl = URL.createObjectURL(blob);

window.location = blobUrl;




Javascript

Related
electron mass to amu Code Example electron mass to amu Code Example
jquery generate post entire page Code Example jquery generate post entire page Code Example
how can we give the index of an array as an ID to an element Code Example how can we give the index of an array as an ID to an element Code Example
veu js vs angular vs react features Code Example veu js vs angular vs react features Code Example
Error: ENOENT: no such file or directory, scandir Code Example Error: ENOENT: no such file or directory, scandir Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7