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

271
Vistas
reading all files in the public folder next.js

I have a folder called Songs in the Public folder. During render time I would like to render them:

const renderSongs = () => {
 [ array of song files ].map(song => {
  ...
 })
}

tho I dont think I can use fs in next.js, so how would i do this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Note: You can import modules in top-level scope for use in getServerSideProps. Imports used in getServerSideProps will not be bundled for the client-side.

This means you can write server-side code directly in getServerSideProps. This includes reading from the filesystem or a database.

Source: https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation

or

https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering

So basically you can use fs, but only in the getStaticProps or getServerSideProps, which will be run at build time, or on the serverside.

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