Skip to main content
Home

read and write tarball archives

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a month ago (0.3.1)

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(...)
	}
}

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@mary/tar

Import symbol

import * as tar from "@mary/tar";
or

Import directly with a jsr specifier

import * as tar from "jsr:@mary/tar";

Add Package

pnpm i jsr:@mary/tar
or (using pnpm 10.8 or older)
pnpm dlx jsr add @mary/tar

Import symbol

import * as tar from "@mary/tar";

Add Package

yarn add jsr:@mary/tar
or (using Yarn 4.8 or older)
yarn dlx jsr add @mary/tar

Import symbol

import * as tar from "@mary/tar";

Add Package

vlt install jsr:@mary/tar

Import symbol

import * as tar from "@mary/tar";

Add Package

npx jsr add @mary/tar

Import symbol

import * as tar from "@mary/tar";

Add Package

bunx jsr add @mary/tar

Import symbol

import * as tar from "@mary/tar";