I am learning back-end and I want to use the faker library to generate about 1000 jpg files of random user images to my local folder.
Script Name: dummyImages.js
const faker = require('faker');
const makeFakeImage = function() {
return faker.image.people();
}
makeFakeImage();
If I run this script using the command
node dummyImages.js
I expect to receive an URL link and I can save and download the image file to my local folder. However, this process is too manual and it's not the best practice. Can someone help me to refractor my script so that it can save 1000 faker image files automatically into a local folder with jpg file name going from "1" to "1000" (ex: 1.jpg 2.jpg etc...). My intent is to insert all files inside that folder into AWS S3 afterward and use them on React.