tar-transform
Version:
extract, transform and re-pack tarball entries in form of stream
32 lines (29 loc) • 1.07 kB
JavaScript
import 'tar-stream';
import 'stream';
export { TarExtract, extract } from './extract.js';
import 'zlib';
export { TarPack, pack } from './pack.js';
export { b as TarEntryTransformer, T as TarTransform, s as streamToBuffer, a as streamToString, t as transform } from './transform-ce45aa22.js';
function isTarEntry(e) {
if (typeof e === "object" && e && "headers" in e) {
const { headers, content, stream } = e;
if (headers &&
typeof headers === "object" &&
typeof headers.name === "string") {
if (headers.pax && headers.name !== headers.pax.path) {
return false;
}
return (
// only content
((typeof content === "string" || content instanceof Buffer) &&
!stream) ||
// only stream
(!!stream && !content) ||
// directory
(!stream && !content && headers.type === "directory"));
}
}
return false;
}
export { isTarEntry };
//# sourceMappingURL=index.js.map