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

233
Views
Elegir un archivo aleatorio de una carpeta en el nodo

Tengo un fodler en mi máquina local y me gustaría elegir un archivo al azar. He intentado usar esto:

 var files = fs.readdirSync(`/Users/...`) random_file = files[Math.floor(Math.random() * files.length)]

Pero a veces obtengo esto como un archivo aleatorio: .DS_Store

Alguien podría ayudarme a arreglar esto por favor

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

0

¡Simplemente ejecute un filtro y devuelva los nombres de archivo! == Ds Store

 files=files.filter(fileName=>fileName!==".DS_Store") random_file = files[Math.floor(Math.random() * files.length)]
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!