Hi there!
I’m new to Glitch, but gotta say I love the concept.
I’m creating a small project where an authorized user can upload audio files, and users can listen to these files in an audio editor.
I was hoping to use the CDN storage that is provided for this project. However, despite my research, I couldn’t find a way to do it. Is it even possible?
I’m using fastify-multiple
to handle the file uploading in a Node.js app:
fastify.post('/upload', async function (req, reply) {
const parts = req.parts()
for await (const part of parts) {
if (part.file) {
await pump(part.file, fs.createWriteStream(".data/" + part.filename))
} else {
console.log(part)
}
}
reply.send()
})
Initially, I was trying to upload to the .data folder which doesn’t get copied when remixing. Then I learnt about the CDN, which sounds like a better approach. This code runs, but doesn’t do anything (no logs nor errors). As could be expected, it doesn’t actually upload the file either.
Any input appreciated!