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

148
Views
Se encuentra con un error de EMFILE al usar jsmediatags

Uso jsmediatags para leer etiquetas de una gran cantidad de archivos (> 20.000). Mi código arroja un error EMFILE (ERROR fs Error: EMFILE: demasiados archivos abiertos, abrir "ruta al archivo") porque excedo la cantidad máxima de archivos abiertos. No puedo usar nada como graceful-js, porque fs está integrado en el módulo. Entonces mi pregunta es: ¿Cómo evito el error EMFILE?

Puedo pensar en 2 formas: usar algo para leer solo lotes de datos a la vez o reemplazar de alguna manera la dependencia fs con graceful-js. Sería muy útil si alguien pudiera indicarme la dirección correcta.

 var addToDatabase = (files) => { for(let i=0;i<files.length;i++){ if(files[i].endsWith(".mp3")){ new jsmediatags.Reader(files[i]) .setTagsToRead(["title", "track", "artist", "album", "year"]) .read({ onSuccess: function(tag) { database.insert({path: files[i], title: tag.tags.title, track: tag.tags.track, artist: tag.tags.artist, album: tag.tags.album, year: tag.tags.year}); }, onError: function(error) { console.log("ERROR", error.type, error.info, files[i]); } }); } } } require('node-dir').files(_some_dir, function(err, files) { if (err) dispatch(rebuildDbRejected("ERROR while reading the database directory")); addToDatabase(files); });
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Modifiqué el NodeFileReader de jsmediatags y ahora parece funcionar.

 const fs = require('fs'); //added these lines var gracefulFs = require('graceful-fs'); gracefulFs.gracefulify(fs);
over 4 years ago · Santiago Trujillo 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!