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

131
Views
Check if directory still exists after app reload

I am saving a FileSystemDirectoryHandle to IndexedDB, so that the web application can reuse it the next time it is started. This usually works fine. But when the directory has been removed from disk in the meantime, and the app still tries to work with it (for example by trying to obtain a file handle inside the directory via directoryHandle.getFileHandle()), an error is thrown, unsurprisingly: NotFoundError: A requested file or directory could not be found at the time an operation was processed.

How to check if the directory still exists before doing anything else with it? In Node.js, there are functions for checking if a directory exists like fs.access and fs.existsSync. But I do not find anything like that with the File System Access API.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your best option right now is indeed try..catch-ing the desired operation and checking the type of the error to equal NotFoundError. The spec has two open issues around improving this: Issue #121 and Issue #244.

about 4 years ago · Juan Pablo Isaza Report
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!