Skip to content

Commit c8447e1

Browse files
committed
fix: reorder read stream initialization to prevent premature stream destruction in upload flow
1 parent 79b6ffb commit c8447e1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

handwritten/storage/src/bucket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4501,11 +4501,11 @@ class Bucket extends ServiceObject<Bucket, BucketMetadata> {
45014501
) {
45024502
newFile.storage.retryOptions.autoRetry = false;
45034503
}
4504-
const readStream = fs.createReadStream(pathString);
45054504
const writable = newFile.createWriteStream(options);
45064505
if (options.onUploadProgress) {
45074506
writable.on('progress', options.onUploadProgress);
45084507
}
4508+
const readStream = fs.createReadStream(pathString);
45094509
readStream
45104510
.on('error', err => {
45114511
readStream.destroy();

0 commit comments

Comments
 (0)