bun
bun copied to clipboard
Buffer.from needs to read `data:` attribute for base64 strings
That's the cause of https://github.com/oven-sh/bun/issues/1729
Are we talking about Node.js Buffer class here? :thinking:
$ cat test.js
const base64 = btoa("PASS");
console.log("PASS -->", base64);
console.log(Buffer.from(base64, "base64").toString());
console.log(Buffer.from("data:text/plain;base64," + base64, "base64").toString());
$ node -v
v18.12.1
$ node test.js
PASS --> UEFTUw==
PASS
u�Z��m��Z�vڱ�PASS
Non-issue, both Bun and Node.js do the same thing:
❯ bun base64.js
PASS --> UEFTUw==
PASS
u�Z��m��Z�vڱ�PASS
❯ node base64.js
PASS --> UEFTUw==
PASS
u�Z��m��Z�vڱ�PASS