Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js local file read to blob variable

let file = new File(['hello', ' ', 'world'], 'hello_world.txt', {type: 'text/plain'});
//or let file = document.querySelector('input[type=file]').files[0];
let reader = new FileReader();
reader.onload = function(e) {
    let blob = new Blob([new Uint8Array(e.target.result)], {type: file.type });
    console.log(blob);
};
reader.readAsArrayBuffer(file);
Comment

PREVIOUS NEXT
Code Example
Javascript :: next-dev.js?3515:32 Warning: Prop `className` did not match. Server Client 
Javascript :: js get each pair of values from an array of objects 
Javascript :: aes 256 file encryption node js 
Javascript :: wait for 1 second in loop in javascript 
Javascript :: javascript submit form programmatically 
Javascript :: SyntaxError: await is only valid in async function 
Javascript :: tailwind css toggle switch react 
Javascript :: truthy and falsy values in javascript 
Javascript :: get user input node js console 
Javascript :: getting data from an api 
Javascript :: child_process npm 
Javascript :: swap numbers in javascript 
Javascript :: phaser2 align text center 
Javascript :: buffer nodejs 
Javascript :: react router dom props.history is undefined 
Javascript :: how to comment out code in react js 
Javascript :: class component react 
Javascript :: Get Keys Of JSON As Array 
Javascript :: put logo in qr code in react js qrcode.react 
Javascript :: create a simple website using javascript 
Javascript :: javascript regex match character from a set of characters 
Javascript :: discord.js create permanent invite 
Javascript :: is string undefined null or empty c# javascript 
Javascript :: javascript variable in html string 
Javascript :: javascript get cell by index 
Javascript :: js group objects in array 
Javascript :: navbar routing in react 
Javascript :: ng-class equivalent in react 
Javascript :: nodejs redirect to url 
Javascript :: Uncaught TypeError: Data.filter is not a function 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =