- Interaction with Cloud Storage is performed using the official Node.js Client library.
- Output of an external executable (
ffmpeg
) throughfluent-ffmpeg
is piped to a writable stream of a Google Cloud Storage object using [createWriteStream
].(https://googleapis.dev/nodejs/storage/latest/File.html#createWriteStream). - Executable (
ffmpeg
) can end with an error. In this case the file is created on Cloud Storage with 0 length. - I want to abort uploading on the command error to avoid finalizing an empty storage object.
What is the proper way of aborting the upload stream?
Current code (just an excerpt):
ffmpeg()
.input(sourceFile.createReadStream())
.output(destinationFile.createWriteStream())
.run();
Files are instances of https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/file.