Read and write tar archives
https://jsr.io/@mary/tar
- TypeScript 100%
| .vscode | initial commit | |
| lib | refactor: remove for-await in TarEntry#body | |
| samples | feat: add tests | |
| deno.json | v0.3.2 | |
| deno.lock | chore: update lockfile | |
| LICENSE | initial commit | |
| README.md | docs: update readme | |
| test.ts | chore: move library code to lib folder | |
tar
Read and write tar archives.
// `writeTarEntry` is designed to be very simplistic, as the name suggests, it
// only spits out a buffer for one file entry. Good for streaming writes, but
// means you'd have to concatenate it yourself if you're doing it in one go.
const buffer = writeTarEntry({
name: 'README.md',
data: `Hello, **world**!`,
});
// `untar` lets you iterate over a tar archive, it's streamed, so you'd need to
// pass a readable stream.
for await (const entry of untar(stream)) {
// If it's a file in the blobs directory...
if (entry.name.startsWith('blobs/')) {
const buffer = await entry.arrayBuffer();
// -> ArrayBuffer(...)
}
}