jsfWriteFile seems to get the wrong dLen(data length) #6540
Replies: 1 comment
-
|
Posted at 2021-05-19 by @gfwilliams Hi, What does If you're just writing a single file, you shouldn't need the
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 Posted at 2021-05-19 by tyronehell thax! Posted at 2021-05-19 by tyronehell Just, wasted several precious hours on my own "firmware" #-D |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2021-05-19 by tyronehell
jsfWriteFile seems to get the wrong dLen(data length), when i enter the code below, i have to encode the data with base64, for some reason(utf8 multibyte Symbol or characters ), some times the data encoded is larger than befor, as use atob(...) when writing to the Storage. for example, the data original is 1000 byte, base64 encoded is 1500 byte, so the question is if i use
require('Storage').write("abc.js",atob("Cmcu...DApOw=="),0,1000);error returned:Uncaught Error: Too much data for file size at line 1 col 5563use
'require('Storage').write("abc.js",atob("Cmcu...DApOw=="),0,1500);'worked fine, but the storage space is wasted a lot ... the final data after base64 decoded just needs 1000 byte :(Beta Was this translation helpful? Give feedback.
All reactions