Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
How would I load an ogg file in node js

My goal is to load ogg files in node.js I've tried ReadFile but hits me up with this error: Could not read file. [Error: ENOENT: no such file or directory, open 'Main\game\songs\test\Voices.ogg'] and the file does exist.

Code:

fs.readdir('./game/songs', function(err, files){
        if (err) {
            console.log("Could not list the directory.", err)
            return
        }
        files.forEach(function(file, index){
            fs.readFile('./game/songs/'+file+"/Inst.ogg", function(err, data){
                if (err) {
                    console.log("Could not read file.", err)
                    return
                }
            })
            fs.readFile('./game/songs/'+file+"/Voices.ogg", function(err, data){
                if (err) {
                    console.log("Could not read file.", err)
                    return
                }
            })
        })
    })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should pass the absolute path of the file, use the built-in path module's join() function:

const path = require('path');
const fs = require('fs');

fs.readFile(path.join(__dirname, 'YOUR_PATH_HERE'), function(err, data) {});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda