getBase64() does not return as proper base64 in Deno Deploy
- Dominant language
- TypeScript
- Stars
- 14.7k
- Forks
- 777
- PR merge metrics
- No merged PRs in 30d
Description
# Expected Behavior
When running getBase64() I expect to get a proper base64 string. It does this in local Deno, but not on Deno Deploy.
# Current Behavior
Somehow the same function on Deno Deploy just returns a comma-separated set of numbers between 0 and 255, like this:
```
data:image/jpeg;base64,255,216,255,224,0,16,74,70,73,70,0,1,1,0,0,1,0,1,0,0,255,219,0,132,0,6,4,5,6,5,4,6,6,5,6,7,7,6,8,10,16,10,10,9,9,10,20,14,15,12,16,23,20,24,24,23,20,22,22,26,29,37,31,26,27,35,28,22,22,32,44,32,35,38,39,41,42,41,25,31,45,48,45,40,48,37,40,41,40,1,7,7,7,10,8,10,19,10,10,19,40,26,22,26,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40 ...
```
# Failure Information (for bugs)
## Steps to Reproduce
It happens on all images; this is an Astro action where a form has a file upload. Fairly vanilla:
And it does NOT do this on local Astro running on Deno. For some reason this is ONLY on Deno Deploy. I have no idea why.
```
const image = await Jimp.fromBuffer(imgBuffer);
const resizedImgBuffer = await image.resize({w: 300}).getBase64(data.profileImage.type, {quality: 80});
console.log("Output:", resizedImgBuffer);
```
## Context
Again, no idea why this happens on Deno Deploy. However, if I use getBuffer, and then convert to base64, it's fine.
On Deno I do get a warning that `This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.` — maybe this has something to do with it, or not at all?
```
import { Buffer } from 'node:buffer';
const image = await Jimp.fromBuffer(imgBuffer);
const resizedImgBuffer = await image.resize({w: 300}).getBuffer(data.profileImage.type, {quality: 80});
data.profileImage.data = Buffer.from(resizedImgBuffer).toString('base64');
```
- Jimp Version: 1.6.0
- Operating System: Mac Sonoma / Deno Deploy
- Node version: Deno 2.1.9
## Failure Logs
None; it doesn't error, it just generates a list of numbers.
Contributor guide
Assessment
This issue has not been assessed yet.