Skip to content

Commit

Permalink
fix: always close gridfs upload stream on finish (#2759)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran authored Mar 22, 2021
1 parent c19f296 commit 1c6f544
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gridfs-stream/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export class GridFSBucketWriteStream extends Writable {
};
writeConcern?: WriteConcern;

/** @event */
static readonly CLOSE = 'close';
/** @event */
static readonly ERROR = 'error';
/**
Expand Down Expand Up @@ -325,6 +327,7 @@ function checkDone(stream: GridFSBucketWriteStream, callback?: Callback): boolea
return __handleError(stream, error, callback);
}
stream.emit(GridFSBucketWriteStream.FINISH, filesDoc);
stream.emit(GridFSBucketWriteStream.CLOSE);
});

return true;
Expand Down

0 comments on commit 1c6f544

Please sign in to comment.