Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/capi/deps/std/archive.ts>Tar

[WIP] A framework for crafting interactions with Substrate chains
Latest
class Tar
import { Tar } from "https://deno.land/x/capi@v0.1.1-beta.1/deps/std/archive.ts";

A class to create a tar archive

Examples

Example 1

import { Tar } from "https://deno.land/std@0.224.0/archive/tar.ts";
import { Buffer } from "https://deno.land/std@0.224.0/io/buffer.ts";
import { copy } from "https://deno.land/std@0.224.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();

Constructors

new
Tar()

Methods

append(fn: string, opts: TarOptions)

Append a file to this tar archive

Get a Reader instance for this tar data