diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-02-02 19:05:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 12:05:46 +0100 |
commit | 6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (patch) | |
tree | fd94c013a19fcb38954844085821ec1601c20e18 /std/archive/README.md | |
parent | a2b5d44f1aa9d64f448a2a3cc2001272e2f60b98 (diff) |
chore: remove std directory (#9361)
This removes the std folder from the tree.
Various parts of the tests are pretty tightly dependent
on std (47 direct imports and 75 indirect imports, not
counting the cli tests that use them as fixtures) so I've
added std as a submodule for now.
Diffstat (limited to 'std/archive/README.md')
-rw-r--r-- | std/archive/README.md | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/std/archive/README.md b/std/archive/README.md deleted file mode 100644 index d6e148322..000000000 --- a/std/archive/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# Usage - -## Tar - -```ts -import { Tar } from "https://deno.land/std@$STD_VERSION/archive/tar.ts"; - -const tar = new Tar(); -const content = new TextEncoder().encode("Deno.land"); -await tar.append("deno.txt", { - reader: new Deno.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 Deno.copy(tar.getReader(), writer); -writer.close(); -``` - -## Untar - -```ts -import { Untar } from "https://deno.land/std@$STD_VERSION/archive/tar.ts"; -import { ensureFile } from "https://deno.land/std@$STD_VERSION/fs/ensure_file.ts"; -import { ensureDir } from "https://deno.land/std@$STD_VERSION/fs/ensure_dir.ts"; - -const reader = await Deno.open("./out.tar", { read: true }); -const untar = new Untar(reader); - -for await (const entry of untar) { - console.log(entry); // metadata - /* - fileName: "archive/deno.txt", - fileMode: 33204, - mtime: 1591657305, - uid: 0, - gid: 0, - size: 24400, - type: 'file' - */ - - if (entry.type === "directory") { - await ensureDir(entry.fileName); - continue; - } - - await ensureFile(entry.fileName); - const file = await Deno.open(entry.fileName, { write: true }); - // <entry> is a reader. - await Deno.copy(entry, file); -} -reader.close(); -``` |