post-image
A tool script used to upload multiple image resources to a cloud server and generate a JSON file with the returned URLs and filenames, making it convenient for front-end developers to copy the paths.
Originally developed for front-end projects where it was necessary to call a back-end API to upload images to a cloud server. This process required manual uploads, which was inconvenient. Therefore, this script was written to automatically upload multiple images to the cloud server.
You need to have a back-end API available that can handle uploading images to the cloud server.
Run yarn or npm install.
- Configure the
config.jsfile with the relevant URLs and other information. - Place the images you want to upload in the
needPostImgfolder. - Execute
node upload.js. - The script will generate aliases and corresponding paths in the
files.jsonfile based on the image names. - Run
node clear.jsto clear the images from theneedPostImgfolder.