Questions tagged [btoa]

6 questions
1
vote
0 answers

Why use new FileReader reader approach to convert to base 64 when you could just use btoa()

I am working on an application in react that uses an api and to make a post we have to send an image in base64 . I was looking on stack overflow and saw this example: function getBase64(file) { var reader = new FileReader(); …
Elise J
  • 11
  • 1
0
votes
0 answers

Encode Google Sheets cell into BASE64 (btoa) string

I am a big Only Connect fan and I have been using the following web-app to create connecting walls: https://dev.to/terrychild/connections-3mod The gameplay data is BASE64 encoded in the URL using the following pattern…
0
votes
1 answer

Is it possible to make a reversible atob from btoa?

Why can't btoa convert back a base64 string? let b64 = "abc123" console.log(btoa(atob(b64))); //abc12w== What happened in the end of the string? I store images in localStorage as DataURI that is basically a Base64 string with a header. Both use…
Dan Froberg
  • 168
  • 8
0
votes
1 answer

How to auth the API with API key and API token storing in .env

I write a nodejs program to call data form API, it is working if I hard code the API key and token. Hard code the API key and token is working: let username = "userid"; //--API_USERNAME let token = "hfdhdfgfdhgs24" //API TOKEN; let auth =…
Jenny Hui
  • 1
  • 1
0
votes
0 answers

Encode string using btoa in javascript and decode in mvc controller

Hello I am trying to encode my string using btoa in javascript, following is the example for the same. LoginPassword.val('chrome'); let password = btoa(String.fromCharCode(LoginPassword.val())); the output looks like below AA== how can I decode the…
Ibrahim shaikh
  • 235
  • 2
  • 15
0
votes
1 answer

btoa behavior with multibyte characters

btoa expects an input string representing binary data, which it will then base64 encode. However, if the input contains multibyte characters it will throw an error because btoa only directly supports input characters within a the Latin1 range of…
Ben Aston
  • 53,718
  • 65
  • 205
  • 331