2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2022-12-04 11:41:50 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Ported and modified from: https://github.com/beatgammit/tar-js and
|
|
|
|
* licensed as:
|
|
|
|
*
|
|
|
|
* (The MIT License)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 T. Jameson Little
|
|
|
|
* Copyright (c) 2019 Jun Kato
|
2024-01-01 21:11:32 +00:00
|
|
|
* Copyright (c) 2018-2024 the Deno authors
|
2022-12-04 11:41:50 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2023-08-31 09:00:41 +00:00
|
|
|
* Tar is a utility for collecting multiple files (or any arbitrary data) into one
|
|
|
|
* archive file, while untar is the inverse utility to extract the files from an
|
docs(archive,assert,cache,cli,encoding,html,http,net,streams,text): remove unstable Markdown alert (#5672)
* docs(archive,cli,html,http,net,streams,text): remove unstable Markdown alert
* update
* fix
* update
* fmt
* fix
2024-08-22 06:55:17 +00:00
|
|
|
* archive. Files are not compressed, only collected into the archive.
|
2023-08-31 09:00:41 +00:00
|
|
|
*
|
2024-09-19 23:29:31 +00:00
|
|
|
* ```ts ignore
|
2024-04-29 02:57:30 +00:00
|
|
|
* import { Tar } from "@std/archive/tar";
|
|
|
|
* import { Buffer } from "@std/io/buffer";
|
|
|
|
* import { copy } from "@std/io/copy";
|
2024-03-11 09:52:36 +00:00
|
|
|
*
|
|
|
|
* const tar = new Tar();
|
|
|
|
*
|
|
|
|
* // Now that we've created our tar, let's add some files to it:
|
|
|
|
*
|
|
|
|
* const content = new TextEncoder().encode("Some arbitrary content");
|
|
|
|
* await tar.append("deno.txt", {
|
|
|
|
* reader: new Buffer(content),
|
|
|
|
* contentSize: content.byteLength,
|
|
|
|
* });
|
|
|
|
*
|
|
|
|
* // This file is sourced from the filesystem (and renamed in the archive)
|
|
|
|
* await tar.append("filename_in_archive.txt", {
|
|
|
|
* filePath: "./filename_on_filesystem.txt",
|
|
|
|
* });
|
|
|
|
*
|
2024-09-16 22:48:56 +00:00
|
|
|
* // Now let's write the tar (with its two files) to the filesystem
|
2024-03-11 09:52:36 +00:00
|
|
|
* // use tar.getReader() to read the contents.
|
|
|
|
*
|
|
|
|
* const writer = await Deno.open("./out.tar", { write: true, create: true });
|
|
|
|
* await copy(tar.getReader(), writer);
|
|
|
|
* writer.close();
|
|
|
|
* ```
|
2022-12-04 11:41:50 +00:00
|
|
|
*
|
2024-09-17 04:38:50 +00:00
|
|
|
* @deprecated Use {@linkcode https://jsr.io/@std/tar | @std/tar} instead.
|
2024-09-24 06:33:53 +00:00
|
|
|
* `@std/archive` will be removed in the future.
|
2024-09-17 04:38:50 +00:00
|
|
|
*
|
docs(archive,assert,cache,cli,encoding,html,http,net,streams,text): remove unstable Markdown alert (#5672)
* docs(archive,cli,html,http,net,streams,text): remove unstable Markdown alert
* update
* fix
* update
* fmt
* fix
2024-08-22 06:55:17 +00:00
|
|
|
* @experimental **UNSTABLE**: New API, yet to be vetted.
|
2024-08-06 12:41:59 +00:00
|
|
|
*
|
2022-12-04 11:41:50 +00:00
|
|
|
* @module
|
|
|
|
*/
|
2023-01-14 10:10:03 +00:00
|
|
|
export * from "./tar.ts";
|
2022-12-04 11:41:50 +00:00
|
|
|
export * from "./untar.ts";
|