Skip to content
Advertisement

Tag: base64

How to convert file to base64 in JavaScript?

UPD TypeScript version is also available in answers Now I’m getting File object by this line: I need to send this file via json in base 64. What should I do to convert it to base64 string? Answer Modern ES6 way (async/await) UPD: If you want to catch errors

Open Base64 in new tab

I have a Base64 encoded document which can be PDF file or image. I would like to create a button in HTML5 page that opens this base64 in a new tab (or new page it does not matter) I found this code can do the trick : It works well. But when I replace the http link with then the

ReadFile in Base64 Nodejs

I’m trying to read an image from client side encoded in base64. How to read with nodejs? My code: But, I got this error: Answer Latest and greatest way to do this: Node supports file and buffer operations with the base64 encoding: Or using the new promises API:

How to read and save attachments using node-imap

I’m using node-imap and I can’t find a straightforward code example of how to save attachments from emails fetched using node-imap to disk using fs. I’ve read the documentation a couple of times. It appears to me I should do another fetch with a reference to the specific part of a message being the attachment. I started of with the

How to strip type from Javascript FileReader base64 string?

I’ve got the following code in my Javascript: This shows me the following data: The thing is that I only want the part after the comma. I tried getting it from reader.result.value, reader.result.valueOf() and some other combinations, but can’t find the correct one to JUST get the base64 string starting from after the comma. So a second idea is to

Creating a BLOB from a Base64 string in JavaScript

I have Base64-encoded binary data in a string: I would like to create a blob: URL containing this data and display it to the user: I haven’t been been able to figure out how to create the BLOB. In some cases I am able to avoid this by using a data: URL instead: However, in most cases the data: URLs

How to convert uint8 Array to base64 Encoded String?

I got a webSocket comunication, I recieve base64 encoded string, convert it to uint8 and work on it, but now I need to send back, I got the uint8 array, and need to convert it to base64 string, so I can send it. How can I make this convertion? Answer All solutions already proposed have severe problems. Some solutions fail

Advertisement