Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

62
Vistas
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})
          });
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.