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;
Also in JavaScript:
- mac os chrome opne debug new tab
- fetch is not defined amazon-cognito-identity-js
- drupal tag filter ajax content
- javascript swap images on mouseover
- javascript picture delete after time
- jsx return greatest number between two numbers
- get element by id in javascript
- javascript get intersection of two arrays
- are you sure javascript
- how to run resize event only on client side angular
- javascript modify href attr
- how to move an ellipse along the x axis in javascript
- capitalize
- how to define variable in javascript
- js image on canvas
- using if statements in javascript
- javascript tostring
- Sum of all the multiples of 3 or 5
- jquery select specific radio button by value
- Property 'find' does not exist on type NodeListOf
- make directive to return dropdown values angular
- jquery get next element
- on enter key press react
- javascript keydown