import { Tar } from "https://deno.land/std@0.194.0/archive/mod.ts";
A class to create a tar archive
Examples
Example 1
Example 1
import { Tar } from "https://deno.land/std@0.194.0/archive/tar.ts";
import { Buffer } from "https://deno.land/std@0.194.0/io/buffer.ts";
import { copy } from "https://deno.land/std@0.194.0/streams/copy.ts";
const tar = new Tar();
const content = new TextEncoder().encode("Deno.land");
await tar.append("deno.txt", {
reader: new Buffer(content),
contentSize: content.byteLength,
});
// Or specifying a filePath.
await tar.append("land.txt", {
filePath: "./land.txt",
});
// 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();
Properties
data: TarDataWithSource[]
Methods
append(fn: string, opts: TarOptions)
Append a file to this tar archive