Implement FileReaderSync
See original GitHub issueThis would solve…
Currently I am doing something that involves keeping everything out of Promise land, however requires reading a Blob
The implementation should look like…
Should look much like the FileReader however have sync behavior. https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync
I have also considered…
Currently attempting to make a workaround with the given FileReader available with Unidici as of now.
Additional context
ex.
function mockFormDataToString(this: FormData) {
const entries = [];
for (const [key, value] of this.entries()) {
if (value instanceof Blob) {
const reader = new FileReaderSync();
reader.readAsText(value);
const result = reader.result;
entries.push([key, result]);
} else {
entries.push([key, value]);
}
}
return JSON.stringify({
__formdata: entries,
});
}
Issue Analytics
- State:
- Created 9 months ago
- Reactions:2
- Comments:26 (22 by maintainers)
Top Results From Across the Web
FileReaderSync - Web APIs - MDN Web Docs
desktop desktop
Chrome Edge
FileReaderSync Full support. Chrome7. Toggle history Full support. Edge12. T...
FileReaderSync() constructor Full support. Chrome7. Toggle history Full support. Edge12. T...
Read more >FileReaderSync - Brian Grinstead
I have been working on updating the FileReader.js JavaScript file reading library lately to help out with a few different projects.
Read more >FileReaderSync - JavaScript: The Definitive Guide, 6th Edition ...
FileReaderSync is a synchronous version of the FileReader API, available only to Worker threads. The synchronous API is easier to use than the...
Read more >FileReaderSync
The FileReaderSync interface allows to read File or Blob objects in a synchronous way.
Read more >FileReaderSync | Can I use... Support tables for HTML5, CSS3 ...
FileReaderSync. - WD. Allows files to be read synchronously in Web Workers. Usage % of. all users, all tracked, tracked desktop, tracked mobile....
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 Free
Top 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
I may have a solution up my sleeve. just going to try it out first
Update: looking good so far… just one more sec to tidy up things.
Here’s an alternative way that does the bare minimum:
index.js
worker.mjs