Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Dec 6, 2024
1 parent 7618fc5 commit 36628de
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/tar-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ npm install @mjackson/tar-parser

## Usage

The main parser interface is the `parseTar(archive, handler)` function:

```ts
import { parseTar } from '@mjackson/tar-parser';

Expand All @@ -32,9 +34,19 @@ await parseTar(response.body.pipeThrough(new DecompressionStream('gzip')), (entr
});
```

If you're parsing an archive with filename encodings other than UTF-8, use the `filenameEncoding` option:

```ts
let response = await fetch(/* ... */);

await parseTar(response.body, { filenameEncoding: 'latin1' }, (entry) => {
console.log(entry.name, entry.size);
});
```

## Benchmark

`tar-parser` performs on par with other popular TAR parsing libraries on Node.js.
`tar-parser` performs on par with other popular tar parsing libraries on Node.js.

```
> @mjackson/[email protected] bench /Users/michael/Projects/remix-the-web/packages/tar-parser
Expand Down

0 comments on commit 36628de

Please sign in to comment.