There was an error while loading. Please reload this page.
1 parent 1b71fcc commit fe1ac65Copy full SHA for fe1ac65
src/file.ts
@@ -2035,6 +2035,16 @@ class File extends ServiceObject<File, FileMetadata> {
2035
emitStream.write(chunk, encoding, cb);
2036
},
2037
});
2038
+ // If the write stream, which is returned to the caller, catches an error we need to make sure that
2039
+ // at least one of the streams in the pipeline below gets notified so that they
2040
+ // all get cleaned up / destroyed.
2041
+ writeStream.once('error', e => {
2042
+ emitStream.destroy(e);
2043
+ });
2044
+ // If the write stream is closed, cleanup the pipeline below by calling destroy on one of the streams.
2045
+ writeStream.once('close', () => {
2046
+ emitStream.destroy();
2047
2048
2049
const transformStreams: Transform[] = [];
2050
0 commit comments