@clearmist-labs/comic-archive-handler 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/API.md CHANGED
@@ -100,6 +100,22 @@ Reads one archive entry and returns its contents as a `Buffer`. Throws `Metadata
100
100
  const page = await cah.readArchiveEntry(comicBuffer, 'P00001.jpg');
101
101
  ```
102
102
 
103
+ ### `readArchiveEntries(input)`
104
+
105
+ Reads every entry's contents and SHA256 in a single pass over the archive, yielding `{ path, size?, buffer, sha256 }` in archive iteration order. Prefer this over calling `readArchiveEntry`/`sha256ArchiveEntry` once per entry: zip and asar support real random access, but the sequential/CLI-driven formats (rar, 7z, ace, tar) re-scan the archive from the start on every such call — reading every entry that way costs O(n^2) instead of O(n) for those formats. It also avoids reading each entry's data twice (once for the hash, once for the buffer).
106
+
107
+ **Options**
108
+
109
+ - `input: ArchiveInput` - A filesystem path or archive `Buffer`.
110
+
111
+ **Example**
112
+
113
+ ```js
114
+ for await (const entry of cah.readArchiveEntries(comicBuffer)) {
115
+ console.log(entry.path, entry.sha256);
116
+ }
117
+ ```
118
+
103
119
  ### `renameArchiveImagesSequentially(input, options?)`
104
120
 
105
121
  Renames image entries in natural-sort order to `P#####.<extension>`, while leaving other entries unchanged.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearmist-labs/comic-archive-handler",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Detect, convert, and manipulate comic book archives: container conversion, edit metadata, image re-encoding, perceptual + content hashing.",
5
5
  "keywords": [
6
6
  "7z",
@@ -39,7 +39,8 @@
39
39
  "exports": {
40
40
  ".": {
41
41
  "types": "./dist/index.d.mts",
42
- "import": "./dist/index.mjs"
42
+ "import": "./dist/index.mjs",
43
+ "require": "./dist/index.mjs"
43
44
  },
44
45
  "./package.json": "./package.json"
45
46
  },