Filesystem.WriteFile doesn't save file correctly
See original GitHub issueWhen saving a file, other than text, it does not display properly in the android file system.
Often when using FileReader.readAsDataURL to create a string from a Blob a header is also created. The android system does not recognize this seemingly or he is formatted wrong, I do not know …
Solution.
Removes the header before creating the file.
//remove header
const split = data.split(',')[1]; //data:image/jpeg;base64,AUIDUHIWad....
data = split[1] || data;
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
fs.writeFile has no errors, but fails to write file - Stack Overflow
the problem is because this call is async and probably is loosing the context right after, I was able to fix it on...
Read more >5 Effortless Steps to Fix "failed to write file to disk" in WordPress
Now that the folders are fixed, it's time to verify the files are set correctly as well. Right click the wp-content folder and...
Read more >How to Fix the "Upload: Failed to Write File to Disk" Error in ...
Is your WordPress site showing the "Upload: Failed to Write File to Disk" error? Bummer, but it's an easy fix. Check out these...
Read more >fs.writeFile() doesn't work properly - Replit
writeFile (); works only as long as someone is editing the project. After that it still edits and works but it resets to...
Read more >File system | Node.js v19.3.0 Documentation
writeFile (data, options); filehandle.writev(buffers[, position]) ... fs.write(fd, buffer[, options], callback); fs.write(fd, string[, position[, encoding]], ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correcting
I’ve fixed it here https://github.com/ionic-team/capacitor/pull/1473
@mhjam, please, if you find issues report them on https://github.com/ionic-team/capacitor/issues as a new issue instead of commenting in old issues. Comments on old issues might be missed.