Firebase Storage put() method uploads an array of numbers instead of a string

Viewed 101

I want to upload a string to a Firebase Storage file. I tried it with

let myString = '...';
storage.ref('path')
    .child('file.txt')
    .putString(myString, 'raw');

and with

let myString = '...';
storage.ref('path')
    .child('file.txt')
    .putString(btoa(myString), 'base64');

and with

let myString = '...';
let array = new TextEncoder("utf-8").encode(myString);
storage.ref('path')
    .child('file.txt')
    .put(myString);

but when I download the files via the Firebase Console, they are always encoded as a string representation of an char array. I.e. the text {"type":"a"} ends up as

123,34,116,121,112,101,34,58,34,97,34,124

which is the ASCII representation of

{"type":"a"}

This is the actual content of the file. Instead of characters, I get a comma-separated list of character codes.

Is that a bug, or am I doing something wrong?

EDIT: In case it matters, this happens in Javascript, on React Native / Expo.

0 Answers
Related