Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

buffer to image nodejs

function toBase64(arr) {
   //arr = new Uint8Array(arr) if it's an ArrayBuffer
   return btoa(
      arr.reduce((data, byte) => data + String.fromCharCode(byte), '')
   );
}

$('#two').prepend($('<img>',{id:'theImg2',src:`data:image/png;base64,${toBase64( selected[0].image2.data)}`}))

Comment

PREVIOUS NEXT
Code Example
Javascript :: change li position in ul jquery 
Javascript :: why does an array index start at 0 
Javascript :: multiple export in react 
Javascript :: jquery add br in text 
Javascript :: framer motion reactjs 
Javascript :: javascript add dom disabled 
Javascript :: javascript array flatten 
Javascript :: which object key has highest value javascript 
Javascript :: vue computed 
Javascript :: js sleep 1 sec 
Javascript :: usb react native device not found 
Javascript :: open youtube video at specific time javascript 
Javascript :: get before 6 month date javascript node js 
Javascript :: Mongoose filter by multiple fields 
Javascript :: jquery post with promises 
Javascript :: react comments 
Javascript :: how to print a array js 
Javascript :: blur effect javascript 
Javascript :: trailing comma javascript 
Javascript :: js delete cookie by name 
Javascript :: import everything javascript 
Javascript :: toastify react not working 
Javascript :: react get url params in class component 
Javascript :: create primary key in mongodb 
Javascript :: update array of objects with use state 
Javascript :: how to use if condition in jquery validation 
Javascript :: check number javascript 
Javascript :: angular how to copy text with button 
Javascript :: animated typing js 
Javascript :: get year javascript copyright 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =