I'm implementing uploading videos to vimeo using the official vimeo library. The problem is that I upload the whole video to the server and only then send it to vimeo. After sending I clean it up, of course, but videos can weight a few gbs, so it's a problem. I'm using async-busboy to save data, tmp to create temporary files. I want to send chunks to my server and upload them to vimeo at the same time, because storing the whole videos can break my server. I need to feed to vimeo a steam somehow.
The thing is vimeo uploads videos by chunks, but you must feed it the whole one when you start. I'm also considering library called vimeo-chunk-upload to upload directly from the front end, but I'll have to store private key in code and that is not safe.
const { files } = await Busboy(request);
const clip = files[0].pipe(fs.createWriteStream(pathname))
clip.on('finish', () => {
vimeo.upload(pathname, ...)
})
The back end implementation causes a lot of problems, but it's safe. If there is a way to upload using chunks to my server, I can proceed. Otherwise, I need to know how to make it safe on the front end, because this approach is so much easy.