If you're just writing a single file, you shouldn't need the ,0,1000 bit - Storage.write will just write a file containing just that data.
utf8 multibyte Symbol or characters
If you have these then that is likely your problem. Obviously if you've got 1000 characters, but some of them are multi-byte, then you're going to end up with more than 1000 bytes in your result, which may be what is happening.
How do you create your base64 encoded string? For instance if you used http://www.espruino.com/File+Converter with a file that was exactly 1000 bytes, I'd be pretty hopeful you would get a 1000 byte value to put in the file
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
What does
atob("Cmcu...DApOw==").length
say?If you're just writing a single file, you shouldn't need the
,0,1000
bit -Storage.write
will just write a file containing just that data.If you have these then that is likely your problem. Obviously if you've got 1000 characters, but some of them are multi-byte, then you're going to end up with more than 1000 bytes in your result, which may be what is happening.
How do you create your base64 encoded string? For instance if you used http://www.espruino.com/File+Converter with a file that was exactly 1000 bytes, I'd be pretty hopeful you would get a 1000 byte value to put in the file