"use strict";const tar=require("../tar"),gzip=require("../gzip"),utils=require("../utils"),stream=require("stream"),pump=require("pump"),ready=require("get-ready");class TgzFileStream extends stream.Transform{constructor(e){super(e=e||{});const r=this._sourceType=utils.sourceType(e.source),t=this._tarStream=new tar.FileStream(e);delete(e=utils.clone(e)).source;const s=new gzip.FileStream(e);s.on("data",e=>{this.push(e)}),s.on("end",()=>this.ready(!0)),pump(t,s,e=>{e&&this.emit("error",e)}),"stream"!==r&&void 0!==r&&this.end()}_transform(e,r,t){this._tarStream.write(e,r,t)}_flush(e){"stream"!==this._sourceType&&void 0!==this._sourceType||this._tarStream.end(),this.ready(e)}}ready.mixin(TgzFileStream.prototype),module.exports=TgzFileStream;