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

206
Views
Unable to access file on local http-server from javascript fs

I'm trying to access the directory listing of files from the http-server webserver listing configured on the localhost:4040.

I have uploaded files using the http-server to mimic a file server for testing. When I use fs to access the files in the folder with the full URL (e.g. http://localhost:4040/folder1/), I get the following error:-

Error: ENOENT: no such file or directory, scandir 'http://localhost:4040/folder1/'

The directory listing is accessible if I browse the same URL through the web browser.

fs
.readdirSync(imagePath)
.forEach((filename, index) => {
   console.log(filename
   files.push({path: imagePath, fileName: filename, fullFileName: imagePath + '/' + filename})
          });
about 4 years ago · Juan Pablo Isaza
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!