Should be able to use bootstrap.js
and then do
const {mkdir, access,} = require('fs/promises')
const { constants } = require(`fs`);
const createFolder = async() => {
try {
await access(`${process.cwd()}/public/uploads`, constants.R_OK);
console.log("Folder exists")
} catch(error) {
await mkdir(`${process.cwd()}/public/uploads`)}
console.log("Created directory")
}
}
think you need to check with the process where it's run from etc, else it will run it from the wrong place.
Better solution would be to make a `public/uploads` folder and inside of it just add `.gitkeep` so it gets committed that way you don't need to make it.
Make sure you don't do this in Docker as there is no point then rather, you then want to use bind the folder etc else it would be deleted on removal of the container.