/** * GNU ustar tar implementation. * * @since 1.0.0 */ import type * as PlatformError from "effect/PlatformError"; import type * as Schema from "effect/Schema"; import * as FileSystem from "effect/FileSystem"; import * as HashMap from "effect/HashMap"; import * as Path from "effect/Path"; import * as Stream from "effect/Stream"; import * as TarCommon from "./Header.ts"; /** * @since 1.0.0 * @category Tar * @example * ```ts * * import * as assert from "node:assert" * * import * as HashMap from "effect/HashMap"; * import * as Stream from "effect/Stream"; * import * as Effect from "effect/Effect"; * import * as Option from "effect/Option"; * import * as Tuple from "effect/Tuple"; * * import * as TarCommon from "eftar/Header"; * import * as Tar from "eftar/Tar"; * import * as Untar from "eftar/Untar"; * * const entries = HashMap.make( * [ * TarCommon.TarHeader.make({ * filename: "file1.txt", * fileSize: 8, * }), * "Hi, mom!", * ], * [ * TarCommon.TarHeader.make({ * filename: "file2.txt", * fileSize: 22, * }), * "Hello from the Tarball", * ], * [ * TarCommon.TarHeader.make({ * filename: "file3.bin", * fileSize: 4, * }), * new Uint8Array([0, 1, 2, 3]), * ] * ); * * const tarStream = Tar.tarball(entries); * const files = await Untar.untar(tarStream).pipe(Effect.runPromise); * * assert.equal(HashMap.size(entries), 3) * const first = HashMap.findFirst(files, (_, header) => header.filename === "file1.txt"); * const second = HashMap.findFirst(files, (_, header) => header.filename === "file2.txt"); * const third = HashMap.findFirst(files, (_, header) => header.filename === "file3.bin"); * * assert.deepStrictEqual( * first.pipe(Option.getOrThrow, Tuple.get(1), Stream.mkUint8Array, Effect.runSync), * new TextEncoder().encode("Hi, mom!") * ); * assert.deepStrictEqual( * second.pipe(Option.getOrThrow, Tuple.get(1), Stream.mkUint8Array, Effect.runSync), * new TextEncoder().encode("Hello from the Tarball") * ); * assert.deepStrictEqual( * third.pipe(Option.getOrThrow, Tuple.get(1), Stream.mkUint8Array, Effect.runSync), * new Uint8Array([0, 1, 2, 3]) * ); * * ```; */ export declare const tarball: (entries: HashMap.HashMap>) => Stream.Stream; /** * @since 1.0.0 * @category Tar */ export declare const tarballFromMemory: (entries: HashMap.HashMap, "fileSize">, string | Uint8Array | readonly [contentSize: number, stream: Stream.Stream]>) => Stream.Stream; /** * @since 1.0.0 * @category Tar */ export declare const tarballFromFilesystem: (base: string, entries: Array) => Stream.Stream; //# sourceMappingURL=Tar.d.ts.map