Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
FileSystemDirectoryReader.readEntries: Is there a way to read files from folder sync?

FileSystemDirectoryReader.readEntries lets us read the file contents however is it is async in nature and I need to do it in a synchronous way. I have tried using async and that doesn't fit my use case as well. What I want is somewhat similiar to this. Which freezes the main thread.

var request = new XMLHttpRequest();
request.open('GET', '/bar/foo.txt', false);  // `false` makes the request synchronous
request.send(null);

if (request.status === 200) {
  console.log(request.responseText);
}

I know it is bad user experience but it seems unavoidable at this point.

The use case

We have multiple event handlers listening to the drop event. I need to so some processing in my event handler (It's guaranteed to be the first one to receive) based on which I can decide whether the other event handlers should not process the event using event.stopImmediatePropagation but if I am doing stuff which is async the other handlers receive and continue to process the event even if I decide to stop propagation. I have no control over the other handlers and cant modify their code

I have tried stopping the propagation before my async call and dispatch the event after processing but that is proving to be difficult as the event.dataTransfer is empty and the other event handlers are not getting the files. Force setting the dataTransfer results in isTrusted being set to false for the event

Javascript DataTransfer items not persisting through async calls

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!