Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert string to file angular

const base64 = '...';
const imageName = 'name.png';
const imageBlob = this.dataURItoBlob(base64);
const imageFile = new File([imageBlob], imageName, { type: 'image/png' });
Comment

convert string to file angular

dataURItoBlob(dataURI) {
   const byteString = window.atob(dataURI);
   const arrayBuffer = new ArrayBuffer(byteString.length);
   const int8Array = new Uint8Array(arrayBuffer);
   for (let i = 0; i < byteString.length; i++) {
     int8Array[i] = byteString.charCodeAt(i);
   }
   const blob = new Blob([int8Array], { type: 'image/png' });    
   return blob;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: get number value from input e.target.value instead of string 
Javascript :: image gallery functions 
Javascript :: javascript folder array randomizer 
Javascript :: json format in .net core 
Javascript :: negative index javascript 
Javascript :: infinite typing effect react 
Javascript :: javascript assigning index number to row in table 
Javascript :: Examples of correct code for the { "typeof": true } option with global declaration: 
Javascript :: how to use same component in multiple place with some logic in angularjs 
Javascript :: Changing the value of a dropdown when the value of a number box changes in AngularJS 
Javascript :: AngularJS SPA edit button function 
Javascript :: Angular js Directive to Fire "click" event on pressing enter key on ANY element 
Javascript :: How to get one items from my Firebase realtime Database with Angular Ionic 
Javascript :: Json response reactnative fetch login data 
Javascript :: react table Maximum update depth exceeded. 
Javascript :: Scaling elements proportionally using CSS and JQUERY 
Javascript :: splunk : json spath extract 
Javascript :: Express.js View "globals" 
Javascript :: make field un updatable mongoose 
Javascript :: read excel file npm 
Javascript :: Modules: Remember All Strings Will Now Have a Property After You Use Require 
Javascript :: phaser reverse matrix rows 
Javascript :: testing code through local server using express.js 
Javascript :: removevalidators angular 
Javascript :: call axios post with an interval 
Javascript :: 20 most common question in javascript 
Javascript :: Hardhat config file multiple network 
Javascript :: react native webview get query params 
Javascript :: vue append component to div 
Javascript :: Backbone Error: Uncaught TypeError: this.set is not a function 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =