Skip to content

Commit

Permalink
Tweak README for 1.2.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
codedread committed Jan 27, 2024
1 parent 08a0fd8 commit 675512c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Introduction

A set of dependency-free JavaScript modules to handle binary data in JS (using
A set of dependency-free JavaScript modules to work with binary data in JS (using
[Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)).
Includes:

Expand All @@ -29,10 +29,10 @@ yarn add @codedread/bitjs

### CommonJS/ESM in Node

This module is an ES Module, which should work as expected in other projects using ES Modules.
However, if you are using CommonJS modules, it's a little trickier to use. One example of this is
if a TypeScript project compiles to CommonJS, it will try to turn imports into require() statements,
which will break. The fix for this (unfortunately) is to update your tsconfig.json:
This module is an ES Module. If your project uses CommonJS modules, it's a little trickier to use.
One example of this is if a TypeScript project compiles to CommonJS, it will try to turn imports
into require() statements, which will break. The fix for this (unfortunately) is to update your
tsconfig.json:

```json
"moduleResolution": "Node16",
Expand All @@ -48,8 +48,8 @@ const { getFullMIMEString } = await import('@codedread/bitjs');

### bitjs.archive

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

#### Decompressing

Expand All @@ -65,7 +65,7 @@ unrar.addEventListener('finish', () => console.log('Done'));
unrar.start();
```

More explanation and examples are located on [the API page](./docs/bitjs.archive.md).
More details and examples are located on [the API page](./docs/bitjs.archive.md).

### bitjs.codecs

Expand Down Expand Up @@ -105,8 +105,10 @@ const mimeType = findMimeType(someArrayBuffer);

### bitjs.image

This package includes code for dealing with binary images. It includes low-level, event-based
parsers for GIF, JPEG, and PNG images. It also includes a module for converting WebP images into
This package includes code for dealing with image files. It includes low-level, event-based
parsers for GIF, JPEG, and PNG images.

It also includes a module for converting WebP images into
alternative raster graphics formats (PNG/JPG), though this latter module is deprecated, now that
WebP images are well-supported in all browsers.

Expand Down Expand Up @@ -172,7 +174,7 @@ const crc = bstream.readBits(12); // read in 12 bits as CRC, advancing the point
const flagbits = bstream.peekBits(6); // look ahead at next 6 bits, but do not advance the pointer
```

More explanation and examples are located on [the API page](./docs/bitjs.io.md).
More details and examples are located on [the API page](./docs/bitjs.io.md).

## Reference

Expand All @@ -182,7 +184,6 @@ RAR file format.
## History

This project grew out of another project of mine, [kthoom](https://github.com/codedread/kthoom) (a
comic book reader implemented in the browser). This repository was automatically exported from
comic book reader implemented in the browser). This repository was automatically exported from
[my original repository on GoogleCode](https://code.google.com/p/bitjs) and has undergone
considerable changes and improvements since then, including adding streaming support, starter RarVM
support, tests, many bug fixes, and updating the code to modern JavaScript and supported features.
considerable changes and improvements since then.
10 changes: 4 additions & 6 deletions archive/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ import { ZipCompressionMethod, getConnectedPort } from './common.js';
* @property {Uint8Array} fileData The bytes of the file.
*/

// export const DeflateCompressionMethod = {
// NO_COMPRESSION: 0,
// COMPRESSION_FIXED_HUFFMAN: 1,
// COMPRESSION_DYNAMIC_HUFFMAN: 2,
// }

/**
* Data elements are packed into bytes in order of increasing bit number within the byte,
* i.e., starting with the least-significant bit of the byte.
Expand All @@ -51,6 +45,10 @@ export const CompressStatus = {
ERROR: 'error',
};

// TODO: Extend EventTarget and introduce subscribe methods (onProgress, onInsert, onFinish, etc).
// TODO: I think appendFiles() is still a good idea so that all files do not have to live in memory
// at once, but the API is wonky here... re-think it. Maybe something more like a builder?

/**
* A thing that zips files.
* NOTE: THIS IS A WORK-IN-PROGRESS! THE API IS NOT FROZEN! USE AT YOUR OWN RISK!
Expand Down
2 changes: 1 addition & 1 deletion archive/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class UnarchiveStartEvent extends UnarchiveEvent {
/** Finish event. */
export class UnarchiveFinishEvent extends UnarchiveEvent {
/**
* @param {Object} metadata A collection fo metadata about the archive file.
* @param {Object} metadata A collection of metadata about the archive file.
*/
constructor(metadata = {}) {
super(UnarchiveEventType.FINISH);
Expand Down

0 comments on commit 675512c

Please sign in to comment.