2024-09-04 08:28:07 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Streaming utilities for working with tar archives.
|
|
|
|
*
|
|
|
|
* Files are not compressed, only collected into the archive.
|
|
|
|
*
|
2024-09-19 23:29:31 +00:00
|
|
|
* ```ts ignore
|
2024-09-04 08:28:07 +00:00
|
|
|
* import { UntarStream } from "@std/tar/untar-stream";
|
|
|
|
* import { dirname, normalize } from "@std/path";
|
|
|
|
*
|
|
|
|
* for await (
|
|
|
|
* const entry of (await Deno.open("./out.tar.gz"))
|
|
|
|
* .readable
|
|
|
|
* .pipeThrough(new DecompressionStream("gzip"))
|
|
|
|
* .pipeThrough(new UntarStream())
|
|
|
|
* ) {
|
|
|
|
* const path = normalize(entry.path);
|
2024-10-16 03:06:55 +00:00
|
|
|
* await Deno.mkdir(dirname(path), { recursive: true });
|
2024-09-04 08:28:07 +00:00
|
|
|
* await entry.readable?.pipeTo((await Deno.create(path)).writable);
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @experimental **UNSTABLE**: New API, yet to be vetted.
|
|
|
|
*
|
|
|
|
* @module
|
|
|
|
*/
|
|
|
|
export * from "./tar_stream.ts";
|
|
|
|
export * from "./untar_stream.ts";
|