this code downloads the files in the project folders, how do i change this to another location?
await new Promise((resolve, reject) => {
let fileExt = post.url.split(".").pop();
request(`${post.url}`)
.pipe(
fs.createWriteStream(
`${post.title.slice(0, 10).replace(/ +/g, "")}.${fileExt}`
)
)
.on("finish", () => {
console.log("download success..!");
resolve();
})
.on("error", (error) => {
console.log("from event ===>", error);
rejects(error);
});
});