@@ -172,21 +172,21 @@ export class GridFSBucketWriteStream extends Writable implements NodeJS.Writable
172172 * @param encoding - Optional encoding for the buffer
173173 * @param callback - Function to call when all files and chunks have been persisted to MongoDB
174174 */
175- end ( ) : void ;
176- end ( chunk : Buffer ) : void ;
177- end ( callback : Callback < GridFSFile | void > ) : void ;
178- end ( chunk : Buffer , callback : Callback < GridFSFile | void > ) : void ;
179- end ( chunk : Buffer , encoding : BufferEncoding ) : void ;
175+ end ( ) : this ;
176+ end ( chunk : Buffer ) : this ;
177+ end ( callback : Callback < GridFSFile | void > ) : this ;
178+ end ( chunk : Buffer , callback : Callback < GridFSFile | void > ) : this ;
179+ end ( chunk : Buffer , encoding : BufferEncoding ) : this ;
180180 end (
181181 chunk : Buffer ,
182182 encoding : BufferEncoding | undefined ,
183183 callback : Callback < GridFSFile | void >
184- ) : void ;
184+ ) : this ;
185185 end (
186186 chunkOrCallback ?: Buffer | Callback < GridFSFile | void > ,
187187 encodingOrCallback ?: BufferEncoding | Callback < GridFSFile | void > ,
188188 callback ?: Callback < GridFSFile | void >
189- ) : void {
189+ ) : this {
190190 const chunk = typeof chunkOrCallback === 'function' ? undefined : chunkOrCallback ;
191191 const encoding = typeof encodingOrCallback === 'function' ? undefined : encodingOrCallback ;
192192 callback =
@@ -196,7 +196,7 @@ export class GridFSBucketWriteStream extends Writable implements NodeJS.Writable
196196 ? encodingOrCallback
197197 : callback ;
198198
199- if ( checkAborted ( this , callback ) ) return ;
199+ if ( checkAborted ( this , callback ) ) return this ;
200200
201201 this . state . streamEnd = true ;
202202
@@ -208,12 +208,14 @@ export class GridFSBucketWriteStream extends Writable implements NodeJS.Writable
208208
209209 if ( ! chunk ) {
210210 waitForIndexes ( this , ( ) => ! ! writeRemnant ( this ) ) ;
211- return ;
211+ return this ;
212212 }
213213
214214 this . write ( chunk , encoding , ( ) => {
215215 writeRemnant ( this ) ;
216216 } ) ;
217+
218+ return this ;
217219 }
218220}
219221
0 commit comments