2

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
  • 909
  • 9
  • 20

2 Answers2

3

Well looking at the node doc is like this.

const fs = require('fs');

const dirnameExportImg = './assets/export'

fs.readdir(dirnameExportImg, function (err, files) {
  if (err) {
    console.log(err)
  }
  files.map(
    (file) => { console.log(file) }
  )
})
54ka
  • 3,501
  • 2
  • 9
  • 24
Yoarthur
  • 909
  • 9
  • 20
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
  • 622
  • 1
  • 9
  • 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