import fs from 'fs' ; import tarFs from '@dylanvann/tar-fs' ; export const extractTar = ( { from , to , } ) : Promise < void > => new Promise ( ( resolve , reject ) => fs . createReadStream ( from ) . pipe ( tarFs . extract ( to ) . on ( 'error' , reject ) . on ( 'finish' , resolve ) ) ) ; export const writeTar = ( { path , cwd , entries , dereference = true , } ) => new Promise ( ( resolve , reject ) => tarFs . pack ( cwd , { entries , dereference } ) . pipe ( fs . createWriteStream ( path ) ) . on ( 'error' , reject ) . on ( 'close' , resolve ) ) ;