Skip to content

Commit 440478c

Browse files
committed
Update docs for gunzip
1 parent 5facf91 commit 440478c

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ A set of dependency-free JavaScript modules to work with binary data in JS (usin
88
[Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)).
99
Includes:
1010

11-
* bitjs/archive: Decompressing files (unzip, unrar, untar) in JavaScript, implemented as Web
12-
Workers where supported, and allowing progressive unarchiving while streaming.
11+
* bitjs/archive: Decompressing files (unzip, unrar, untar, gunzip) in JavaScript, implemented as
12+
Web Workers where supported, and allowing progressive unarchiving while streaming.
1313
* bitjs/codecs: Get the codec info of media containers in a ISO RFC6381 MIME type string.
1414
* bitjs/file: Detect the type of file from its binary signature.
1515
* bitjs/image: Parsing GIF, JPEG, PNG. Conversion of WebP to PNG or JPEG.
@@ -49,7 +49,7 @@ const { getFullMIMEString } = await import('@codedread/bitjs');
4949
### bitjs.archive
5050

5151
This package includes objects for decompressing and compressing binary data in popular archive
52-
formats (zip, rar, tar). Here is a simple example of unrar:
52+
formats (zip, rar, tar, gzip). Here is a simple example of unrar:
5353

5454
#### Decompressing
5555

docs/bitjs.archive.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# bitjs.archive
22

3-
This package includes objects for unarchiving binary data in popular archive formats (zip, rar, tar)
4-
providing unzip, unrar and untar capabilities via JavaScript in the browser or various JavaScript
5-
runtimes (node, deno, bun).
3+
This package includes objects for unarchiving binary data in popular archive formats (zip, rar,
4+
tar, gzip) providing unzip, unrar, untar, gunzip capabilities via JavaScript in the browser or
5+
various JavaScript runtimes (node, deno, bun).
66

7-
A prototype version of a compressor that creates Zip files is also present.
7+
A compressor that creates Zip files is also present.
88

99
The decompression / compression happens inside a Web Worker, if the runtime supports it (browsers,
1010
deno). The library uses native decompression, if supported by the browser
11-
(via [DecompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream/DecompressionStream)), and falls back to JavaScript implementations otherwise.
11+
(via [DecompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream/DecompressionStream)),
12+
and falls back to JavaScript implementations otherwise.
1213

1314
The API is event-based, you will want to subscribe to some of these events:
1415
* 'progress': Periodic updates on the progress (bytes processed).
@@ -31,7 +32,7 @@ etc.
3132
```javascript
3233
import { Unzipper } from './bitjs/archive/decompress.js';
3334
const unzipper = new Unzipper(zipFileArrayBuffer);
34-
unzipper.addEventListener('extract', (evt) => {
35+
unzipper.onExtract(evt => {
3536
const {filename, fileData} = evt.unarchivedFile;
3637
console.log(`unzipped ${filename} (${fileData.byteLength} bytes)`);
3738
// Do something with fileData...
@@ -40,7 +41,7 @@ etc.
4041
unzipper.start();
4142
```
4243

43-
`start()` is an async method that resolves a `Promise` when the unzipping is complete, so you can
44+
`start()` is an async method that resolves a `Promise` when the decompression is complete, so you can
4445
`await` on it, if you need to.
4546

4647
### Progressive unzipping
@@ -65,14 +66,14 @@ constructor, and send subsequent `ArrayBuffers` using the `update()` method.
6566

6667
### getUnarchiver()
6768

68-
If you don't want to bother with figuring out if you have a zip, rar, or tar file, you can use the
69-
convenience method `getUnarchiver()`, which sniffs the bytes for you and creates the appropriate
69+
If you don't want to bother with figuring out if you have a zip, rar, tar, or gz file, you can use
70+
the convenience method `getUnarchiver()`, which sniffs the bytes for you and creates the appropriate
7071
unarchiver.
7172

7273
```javascript
7374
import { getUnarchiver } from './bitjs/archive/decompress.js';
7475
const unarchiver = getUnarchiver(anArrayBuffer);
75-
unarchive.addEventListener('extract', () => {...});
76+
unarchiver.onExtract(evt => {...});
7677
// etc...
7778
unarchiver.start();
7879
```

0 commit comments

Comments
 (0)