Skip to content

Commit cda459e

Browse files
lundibundiaddaleax
authored andcommitted
zlib: replace usage of internal stream state with public api
Refs: #445 PR-URL: #34884 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 481cced commit cda459e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎lib/zlib.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,15 @@ const kFlushBuffers = [];
349349
}
350350

351351
ZlibBase.prototype.flush=function(kind,callback){
352-
constws=this._writableState;
353-
354352
if(typeofkind==='function'||(kind===undefined&&!callback)){
355353
callback=kind;
356354
kind=this._defaultFullFlushFlag;
357355
}
358356

359-
if(ws.ended){
357+
if(this.writableFinished){
360358
if(callback)
361359
process.nextTick(callback);
362-
}elseif(ws.ending){
360+
}elseif(this.writableEnded){
363361
if(callback)
364362
this.once('end',callback);
365363
}else{
@@ -386,8 +384,7 @@ ZlibBase.prototype._transform = function(chunk, encoding, cb){
386384
}
387385

388386
// For the last chunk, also apply `_finishFlushFlag`.
389-
constws=this._writableState;
390-
if((ws.ending||ws.ended)&&ws.length===chunk.byteLength){
387+
if(this.writableEnded&&this.writableLength===chunk.byteLength){
391388
flushFlag=maxFlush(flushFlag,this._finishFlushFlag);
392389
}
393390
processChunk(this,chunk,flushFlag,cb);

0 commit comments

Comments
(0)