Skip to content

Commit 07d7388

Browse files
durranljhaywar
authored andcommitted
fix: always close gridfs upload stream on finish (#2759)
1 parent e296c99 commit 07d7388

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/gridfs-stream/upload.ts

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export class GridFSBucketWriteStream extends Writable {
6767
};
6868
writeConcern?: WriteConcern;
6969

70+
/** @event */
71+
static readonly CLOSE = 'close';
7072
/** @event */
7173
static readonly ERROR = 'error';
7274
/**
@@ -325,6 +327,7 @@ function checkDone(stream: GridFSBucketWriteStream, callback?: Callback): boolea
325327
return __handleError(stream, error, callback);
326328
}
327329
stream.emit(GridFSBucketWriteStream.FINISH, filesDoc);
330+
stream.emit(GridFSBucketWriteStream.CLOSE);
328331
});
329332

330333
return true;

0 commit comments

Comments
 (0)