1

I'm working on retrieve images from csv file. Right now, i could manage.

  • retrieve data base64 images from a csv file
  • convert base64 image & export it as a .jpeg files in a directory

which the directory is like this

├── assets
    ├── export
        ├── img1.jpeg
        ├── img2.jpeg
        ├── img3.jpeg
        ├── ...

how do i get all imgs path from the export directory?.

Yoarthur
  • 869
  • 9
  • 19

2 Answers2

2

Well looking at the node doc is like this.

const dirnameExportImg = './assets/export'

fs.readdir(dirnameExportImg, function (err, files) {
  if (err) {
    console.log(err)
  }
  files.map(
    (file) => { console.log(file) }
  )
})
Yoarthur
  • 869
  • 9
  • 19
0

I think this post might by usefull for you StackOverflow - Reading all files

First answer describes very good how to iterate over multiple files in directory and get them stored into object.

Community
  • 1
  • 1
p7adams
  • 552
  • 1
  • 7
  • 24
  • hi, i read it before made my post, but it was to op for what i was looking for, also is a great post that worth chek it. – Yoarthur Dec 07 '18 at 18:56