This package has been archived, and as such it is read-only.
Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
denoland/stdDEPRECATED: Use @std/tar
Deprecated
Use @std/tar
instead.
@std/archive
will be removed in the future.
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 archive. Files are not compressed, only collected into the archive.
import { Tar } from "@std/archive/tar"; import { Buffer } from "@std/io/buffer"; import { copy } from "@std/io/copy"; 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", }); // Now let's write the tar (with its two files) to the filesystem // 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();
Built and signed on
View transparency logGitHub Actions
Add Package
deno add jsr:@std/archive
Import symbol
import * as archive from "@std/archive";
---- OR ----
Import directly with a jsr specifier
import * as archive from "jsr:@std/archive";