I am inside of a folder src
and want to create files insides another folder called dist
. Below is what I want to do from inside the src
folder. Create a json file inside of dist/JSON/{file goes here}
main
- src
index.js
- dist
- JSON
file.json
So my code is:
const file = path.resolve(__dirname, `/dist/JSON/${filename}.json`);
await fs.outputJson(file, {name: "name"})
This is putting the file however inside of src/dist/JSON/${filename}.json
and I want dist/JSON/${filename}.json