Closed martinRenou closed 2 years ago
Attempt to fix #17
The implementation I'm suggesting here looks for the mimetype:
if (file.type === 'image/png') { format = 'base64'; } else { format = 'text'; }
For comparison, jupyter_server seems to try to encode the file content to utf8, if that fails it falls back to base64: https://github.com/jupyter-server/jupyter_server/blob/25ec3ed0dad617a4388db865e9c1a585e54c0b7c/jupyter_server/services/contents/fileio.py#L300-L327
I wonder if we could implement something similar in JavaScript
https://user-images.githubusercontent.com/21197331/162987570-c8084882-9176-4bdb-a3bb-4c969830c60a.mp4
Thanks!
Attempt to fix #17
The implementation I'm suggesting here looks for the mimetype:
For comparison, jupyter_server seems to try to encode the file content to utf8, if that fails it falls back to base64: https://github.com/jupyter-server/jupyter_server/blob/25ec3ed0dad617a4388db865e9c1a585e54c0b7c/jupyter_server/services/contents/fileio.py#L300-L327
I wonder if we could implement something similar in JavaScript
https://user-images.githubusercontent.com/21197331/162987570-c8084882-9176-4bdb-a3bb-4c969830c60a.mp4