remodelling to similar API as archive/tar package