bagit-node 0.0.0-stage → 1.1.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +6 -0
  4. package/README.md +246 -2
  5. package/dist/cjs/bag.d.ts +59 -0
  6. package/dist/cjs/bag.d.ts.map +1 -0
  7. package/dist/cjs/bag.js +329 -0
  8. package/dist/cjs/bag.js.map +1 -0
  9. package/dist/cjs/errors.d.ts +32 -0
  10. package/dist/cjs/errors.d.ts.map +1 -0
  11. package/dist/cjs/errors.js +60 -0
  12. package/dist/cjs/errors.js.map +1 -0
  13. package/dist/cjs/index.d.ts +6 -0
  14. package/dist/cjs/index.d.ts.map +1 -0
  15. package/dist/cjs/index.js +39 -0
  16. package/dist/cjs/index.js.map +1 -0
  17. package/dist/cjs/package.json +1 -0
  18. package/dist/cjs/types.d.ts +29 -0
  19. package/dist/cjs/types.d.ts.map +1 -0
  20. package/dist/cjs/types.js +3 -0
  21. package/dist/cjs/types.js.map +1 -0
  22. package/dist/cjs/util.d.ts +39 -0
  23. package/dist/cjs/util.d.ts.map +1 -0
  24. package/dist/cjs/util.js +355 -0
  25. package/dist/cjs/util.js.map +1 -0
  26. package/dist/cjs/zip.d.ts +49 -0
  27. package/dist/cjs/zip.d.ts.map +1 -0
  28. package/dist/cjs/zip.js +371 -0
  29. package/dist/cjs/zip.js.map +1 -0
  30. package/dist/esm/bag.d.ts +59 -0
  31. package/dist/esm/bag.d.ts.map +1 -0
  32. package/dist/esm/bag.js +322 -0
  33. package/dist/esm/bag.js.map +1 -0
  34. package/dist/esm/errors.d.ts +32 -0
  35. package/dist/esm/errors.d.ts.map +1 -0
  36. package/dist/esm/errors.js +50 -0
  37. package/dist/esm/errors.js.map +1 -0
  38. package/dist/esm/index.d.ts +6 -0
  39. package/dist/esm/index.d.ts.map +1 -0
  40. package/dist/esm/index.js +5 -0
  41. package/dist/esm/index.js.map +1 -0
  42. package/dist/esm/types.d.ts +29 -0
  43. package/dist/esm/types.d.ts.map +1 -0
  44. package/dist/esm/types.js +2 -0
  45. package/dist/esm/types.js.map +1 -0
  46. package/dist/esm/util.d.ts +39 -0
  47. package/dist/esm/util.d.ts.map +1 -0
  48. package/dist/esm/util.js +326 -0
  49. package/dist/esm/util.js.map +1 -0
  50. package/dist/esm/zip.d.ts +49 -0
  51. package/dist/esm/zip.d.ts.map +1 -0
  52. package/dist/esm/zip.js +365 -0
  53. package/dist/esm/zip.js.map +1 -0
  54. package/package.json +47 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 1.1.0
4
+
5
+ - Add `BagZipOptions.tagFiles` for lazy root and nested tag files across all streaming ZIP APIs. Accepts synchronous or asynchronous iterables of `BagZipEntry`.
6
+ - Stream and hash tag bytes with backpressure, include checksums in every configured tagmanifest, and preserve payload counts and progress semantics.
7
+ - Reject unsafe paths, duplicates, Unicode normalization conflicts, generated-file conflicts, and file/directory collisions.
8
+ - Destroy active readable sources on cancellation, including sources waiting for bytes; preserve manifest cleanup and atomic file output.
9
+ - Document direct S3/Ceph streaming with root `metadata.json` and fresh sources for retries. Preserve ESM, CommonJS, and TypeScript support.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dcbeck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ BagIt behavior and compatibility tests are based on LibraryOfCongress/bagit-python:
2
+ https://github.com/LibraryOfCongress/bagit-python
3
+ Reference commit: 4bd2713cedbe1f8e634567c20ef0dded9622011d
4
+ Upstream identifies its Python code as public domain.
5
+ The test/vendor directory contains unmodified reference material for testing only
6
+ and is excluded from npm releases. See test/vendor/bagit-python/README.md.
package/README.md CHANGED
@@ -1,3 +1,247 @@
1
- # Temporary Holding Version
1
+ # bagit-node
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A TypeScript implementation of the [Library of Congress BagIt Python library](https://github.com/LibraryOfCongress/bagit-python), with ESM and CommonJS APIs. Uses Node's standard libraries for BagIt and [yazl](https://github.com/thejoshwolfe/yazl) for ZIP output: one direct runtime dependency, with its small `buffer-crc32` dependency. Requires Node.js 20.19 or newer. Python is needed only for the optional compatibility tests.
4
+
5
+ Creates and validates [RFC 8493 BagIt 1.0](https://www.rfc-editor.org/rfc/rfc8493.html) bags, reads older bags from version 0.93, and streams folders or application-provided sources into ZIP64 archives.
6
+
7
+ ## Build and import
8
+
9
+ ```sh
10
+ npm install
11
+ npm run build
12
+ ```
13
+
14
+ ```ts
15
+ // ESM / TypeScript
16
+ import { Bag, makeBag, folderToBagZip, createBagZipStream } from 'bagit-node';
17
+ ```
18
+
19
+ ```js
20
+ // CommonJS
21
+ const { Bag, makeBag, folderToBagZip, createBagZipStream } = require('bagit-node');
22
+ ```
23
+
24
+ Both formats include TypeScript declarations. Development dependencies are TypeScript and type definitions. There is no CLI.
25
+
26
+ ## Create a bag in place
27
+
28
+ ```ts
29
+ const bag = await makeBag('/exports/my-folder', {
30
+ bagInfo: {
31
+ 'Source-Organization': 'My archive',
32
+ 'Contact-Name': ['Alice', 'Bob'],
33
+ 'External-Identifier': 'collection-123',
34
+ },
35
+ checksums: ['sha256', 'sha512'], // defaults
36
+ concurrency: 4, // default: 1 simultaneous file read
37
+ });
38
+
39
+ await bag.validate();
40
+ ```
41
+
42
+ This moves the folder's existing contents into `data/`, preserves directory permissions, and writes `bagit.txt`, `bag-info.txt`, payload manifests, and tag manifests. An existing `data/` becomes `data/data/`, matching Python. Empty payloads receive empty manifests and remain valid. The function never changes the process working directory.
43
+
44
+ `Bagging-Date` defaults to the local calendar date. `Bag-Software-Agent` defaults to `bagit-node v1.1.0`. Both may be overridden. `Payload-Oxum` is always calculated from the payload. New bags use UTF-8.
45
+
46
+ ## Open, inspect, validate, and save
47
+
48
+ ```ts
49
+ const bag = new Bag('/exports/existing-bag');
50
+ // Opening reads declaration, metadata, and manifests synchronously.
51
+ // Hashing, validation, and saving are asynchronous.
52
+
53
+ console.log(bag.info, bag.algorithms, bag.versionInfo);
54
+ console.log([...bag.payloadFiles()]);
55
+ console.log(bag.payloadEntries()); // { 'data/file.txt': { sha256: '...', ... } }
56
+
57
+ await bag.validate(); // structure, oxum, completeness, hashes
58
+ await bag.validate({ fast: true }); // structure and oxum; requires Payload-Oxum
59
+ await bag.validate({ completenessOnly: true }); // structure, oxum, filenames; no hashes
60
+ console.log(await bag.isValid()); // boolean for BagError failures
61
+
62
+ bag.info['Contact-Name'] = 'New contact';
63
+ await bag.save(); // preserves payload manifests, regenerates tag manifests
64
+
65
+ // After deliberately adding, removing or updating payload files:
66
+ await bag.save({ manifests: true }); // also regenerates payload manifests and oxum
67
+ ```
68
+
69
+ `validate`, `isValid`, and `save` accept `concurrency` and `signal`. Cancellation and programming errors propagate; `isValid` catches only bag errors. An open `Bag` retains its loaded manifest entries, like Python; construct a new instance to reload external manifest changes.
70
+
71
+ | API | Result |
72
+ | --- | --- |
73
+ | `bag.manifestFiles()` / `bag.tagmanifestFiles()` | Iterators of absolute manifest paths |
74
+ | `bag.payloadFiles()` | Iterator of payload paths relative to the bag |
75
+ | `bag.payloadEntries()` / `bag.tagfileEntries()` | Filename → algorithm → checksum objects |
76
+ | `bag.compareManifestsWithFs()` | `[missingFiles, unexpectedFiles]` |
77
+ | `bag.missingOptionalTagfiles()` | Iterator of missing tag files listed in manifests |
78
+ | `bag.fetchEntries()` | Iterator of `[url, sizeString, filename]` tuples |
79
+ | `bag.filesToBeFetched()` | Iterator of paths listed in `fetch.txt` |
80
+ | `bag.compareFetchWithFs()` | Fetch paths not present in the payload |
81
+ | `bag.validateFetch()` | Checks fetch URLs and safe paths; does not download files |
82
+ | `bag.hasOxum()` | Whether metadata contains `Payload-Oxum` |
83
+
84
+ Python-style method aliases such as `payload_files`, `is_valid`, and `fetch_entries` are available. The exported `make_bag` alias takes the same **options object** as `makeBag`; Python positional argument conventions are not used in the Node API.
85
+
86
+ Validation errors are structured:
87
+
88
+ ```ts
89
+ import { BagValidationError, ChecksumMismatch } from 'bagit-node';
90
+
91
+ try {
92
+ await bag.validate();
93
+ } catch (error) {
94
+ if (error instanceof BagValidationError) {
95
+ for (const detail of error.details) {
96
+ console.error(detail.path, detail.message);
97
+ if (detail instanceof ChecksumMismatch) {
98
+ console.error(detail.algorithm, detail.expected, detail.found);
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ Exported error classes: `BagError`, `BagValidationError`, `ManifestErrorDetail`, `ChecksumMismatch`, `FileMissing`, `UnexpectedFile`, and `FileNormalizationConflict`.
106
+
107
+ Lower-level helpers include `makeManifests(bagRoot, options)`, `makeTagManifests(bagRoot, algorithms)`, `generateManifestLines(filename, algorithms)`, `loadTagFile`, `parseTagFile`, `serializeTagFile`, `encodeFilename`, `decodeFilename`, `normalizeUnicode`, `buildUnicodeNormalizedLookupDict`, and `getHashers`. `generateManifestLines` reads a file once and returns `[algorithm, digest, filename, byteCount]` tuples, with byte counts as `bigint`. Constants include `VERSION`, `DEFAULT_CHECKSUMS`, `CHECKSUM_ALGOS`, `HASH_BLOCK_SIZE`, and `STANDARD_BAG_INFO_HEADERS`.
108
+
109
+ ## Stream a folder to a BagIt ZIP
110
+
111
+ ```ts
112
+ const result = await folderToBagZip('/exports/source', '/exports/source.bag.zip', {
113
+ bagName: 'my-bag', // optional containing directory; default: archive root
114
+ bagInfo: { 'External-Identifier': 'collection-123' },
115
+ checksums: ['sha256', 'sha512'],
116
+ compressionLevel: 6, // 0–9
117
+ onProgress({ path, totalFiles, totalBytes }) {
118
+ console.log(path, totalFiles, totalBytes);
119
+ },
120
+ });
121
+
122
+ console.log(result.payloadFiles, result.payloadBytes, result.bytesWritten);
123
+ ```
124
+
125
+ The source directory remains intact. The output path must be outside it. File output is written to a temporary sibling and renamed after successful completion, preserving an existing destination if generation fails. A writable stream is also accepted and is ended by the method:
126
+
127
+ ```ts
128
+ import { createWriteStream } from 'node:fs';
129
+
130
+ await folderToBagZip('/exports/source', createWriteStream('/exports/source.bag.zip'));
131
+ ```
132
+
133
+ `folderToBagitZip` is an alias for `folderToBagZip`.
134
+
135
+ Each source file is opened once. Its bytes pass through incremental hashing, ZIP deflate compression, and the output stream with backpressure. Checksums cover the original bytes before compression. Custom tag files, when supplied, follow payload entries, then payload manifests, bag metadata, and tag manifests. ZIP64 supports files and offsets above 4 GiB and more than 65,535 entries.
136
+
137
+ Payloads, custom tag files, and the complete ZIP are never buffered or staged by the streaming APIs. Payload manifests are spooled to temporary files, removed on completion, cancellation, or failure. Memory holds stream buffers, ZIP central directory metadata, and filenames/checksums for duplicate checks and tag manifests; it grows with the number of entries, not their byte sizes. `tempDirectory` selects the spool location and must be outside a folder source. Directory exports preserve empty directories, ZIP timestamps, and Unix modes. `mtime` sets a fixed ZIP timestamp for reproducible exports. Yazl automatically uses ZIP64 when needed, so small archives remain compatible with ordinary ZIP readers.
138
+
139
+ Source changes detected while a file is read cause export to fail. Keep sources stable during export: this is not a filesystem snapshot. Symlinks resolving outside the source are rejected, and folder export rejects directory symlinks. Custom source iterables must honor cancellation during their own pending I/O.
140
+
141
+ ## Pipe directly to Ceph / S3 multipart upload
142
+
143
+ `createBagZipStreamFromEntries` returns a standard Node `Readable`, suitable for your existing multipart uploader. Use `tagFiles` to keep an application's `metadata.json` at the bag root while streaming lazy payloads directly to S3 or Ceph. For example, if your application already uses the AWS SDK:
144
+
145
+ ```ts
146
+ import { Readable } from 'node:stream';
147
+ import { createBagZipStreamFromEntries } from 'bagit-node';
148
+ import { Upload } from '@aws-sdk/lib-storage'; // application dependency, not a bagit-node dependency
149
+
150
+ const controller = new AbortController();
151
+ const metadata = { id: 'collection-123', description: 'Export metadata' };
152
+ const payloadEntries = [
153
+ { path: 'images/original.tif', open: () => openOriginalImageStream() }, // application source
154
+ ];
155
+ const body = createBagZipStreamFromEntries(payloadEntries, {
156
+ signal: controller.signal,
157
+ checksums: ['sha256', 'sha512'],
158
+ bagInfo: { 'Contact-Name': 'Exporter' },
159
+ tagFiles: [
160
+ {
161
+ path: 'metadata.json', // relative to the bag root
162
+ open: () => Readable.from([Buffer.from(JSON.stringify(metadata), 'utf8')]),
163
+ },
164
+ ],
165
+ });
166
+
167
+ const upload = new Upload({
168
+ client: s3Client, // configured by your application for S3 or Ceph
169
+ params: {
170
+ Bucket: 'archive',
171
+ Key: 'collection-123.bag.zip',
172
+ Body: body,
173
+ ContentType: 'application/zip',
174
+ },
175
+ queueSize: 4,
176
+ partSize: 8 * 1024 * 1024,
177
+ });
178
+
179
+ try {
180
+ await upload.done();
181
+ } catch (error) {
182
+ controller.abort(error);
183
+ await upload.abort().catch(() => {});
184
+ throw error;
185
+ }
186
+ ```
187
+
188
+ This writes `data/images/original.tif`, root `metadata.json`, `bagit.txt`, `bag-info.txt`, payload manifests, and tag manifests. For a folder source, pass the same options to `createBagZipStream('/exports/source', options)`.
189
+
190
+ The uploader's queue adds its own multipart buffers. A content length is not known before streaming. The stream emits source, compression, and filesystem errors; use an error-aware consumer such as `pipeline` or your multipart uploader. A consumed stream cannot be replayed. To retry or generate a temporary ZIP fallback, call the export API again with fresh payload and tag-file iterables, and have every `open()` return a fresh stream or iterable. Recreate async generators for each attempt and keep sources stable across retries.
191
+
192
+ ## Build a ZIP directly from application sources
193
+
194
+ `createBagZipStreamFromEntries` accepts an iterable or async iterable of lazy sources. This lets exporters produce bytes without writing ordinary payload files to a staging folder.
195
+
196
+ ```ts
197
+ import { Readable } from 'node:stream';
198
+ import { createBagZipStreamFromEntries } from 'bagit-node';
199
+
200
+ async function* entries() {
201
+ yield {
202
+ path: 'record.json', // relative to data/; do not include the data/ prefix
203
+ open: () => Readable.from([Buffer.from(JSON.stringify({ id: 123 }))]),
204
+ };
205
+ yield {
206
+ path: 'images/original.tif',
207
+ open: async () => openOriginalImageStream(), // supplied by your application
208
+ };
209
+ }
210
+
211
+ const body = createBagZipStreamFromEntries(entries(), {
212
+ bagInfo: { 'External-Identifier': 'collection-123' },
213
+ });
214
+ // Pass body to your multipart uploader or pipeline(body, destination).
215
+ ```
216
+
217
+ `open()` is called lazily, once per entry, and returns a `Readable`, iterable, or async iterable of `Uint8Array`/`Buffer` chunks, or a promise for one. Payloads and custom tag files are read sequentially, one source at a time, with backpressure. Source lengths need not be known. Entries may set `mtime`, `mode`, and `directory: true` (with `open: () => []`) for empty directories. Progress callbacks are awaited after each completed payload; tag files do not trigger them.
218
+
219
+ `BagZipOptions.tagFiles?: Iterable<BagZipEntry> | AsyncIterable<BagZipEntry>` is supported by `createBagZipStreamFromEntries`, `createBagZipStream`, `folderToBagZip`, and its `folderToBagitZip` alias. Tag paths are relative to the bag root, support nested names such as `metadata/description.json`, and receive the optional `bagName` prefix in the ZIP. Every configured tagmanifest records their original-byte checksums. They are excluded from payload manifests, payload byte/file totals, and `Payload-Oxum`. Root `metadata.json` can coexist with payload `data/metadata.json`. Omitting `tagFiles` preserves the existing layout and behavior.
220
+
221
+ Archive paths must be relative POSIX paths. Absolute paths, traversal, backslashes, duplicate paths, Unicode normalization collisions, and file/directory conflicts are rejected. CR/LF filenames are encoded in manifests. Literal `%0A`/`%0D` in names and trailing whitespace that cannot round-trip through Python's manifest parser are rejected by ZIP export.
222
+
223
+ Custom tag paths follow the same rules and cannot occupy `data/`, `bagit.txt`, `bag-info.txt`, or root `manifest-*.txt` / `tagmanifest-*.txt` paths, including their descendants. Leading whitespace or `*` in a tag path is also rejected because manifest parsers strip it. Tag manifests never list themselves or other tag manifests. Cancellation or failure destroys active readable sources and removes temporary manifests. Application iterables must honor cancellation during their own pending I/O.
224
+
225
+ ## Compatibility and verification
226
+
227
+ The reference is pinned at [`4bd2713`](https://github.com/LibraryOfCongress/bagit-python/tree/4bd2713cedbe1f8e634567c20ef0dded9622011d). Test-only upstream files and fixtures are included under `test/vendor/` and excluded from npm packages.
228
+
229
+ ```sh
230
+ npm test # Node API, ESM/CommonJS, validation and streaming failure tests
231
+ npm run test:upstream # 96 unchanged upstream library cases through a Python → Node transport
232
+ npm run test:interop # independent Python validation and byte comparisons; stdlib ZIP extraction
233
+ npm run test:stress # actual >4 GiB file and >65,535 archive entries
234
+ npm run test:all # all of the above
235
+ ```
236
+
237
+ Compatibility/stress tests require Python 3; no Python packages need installing. Permission tests should run as a regular user, as in the upstream suite. The Python adapter only translates calls, options, and errors; creation, parsing, hashing, and validation execute in Node. Upstream CLI tests are omitted because this package deliberately has no CLI. Three Python multiprocessing implementation tests are inapplicable; Node uses bounded asynchronous file I/O and has separate cancellation/failure tests.
238
+
239
+ Supported checksum names are `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `sha3_224`, `sha3_256`, `sha3_384`, `sha3_512`, `blake2b`, and `blake2s`, subject to the Node OpenSSL build. Unsupported requested names are skipped if another supported algorithm remains. SHAKE algorithms require a digest length and are not supported by upstream's fixed-length BagIt manifest generation either.
240
+
241
+ The implementation preserves Python's metadata formatting, manifest syntax, default SHA-256/SHA-512 algorithms, repeated tags, folded tags, mixed-case checksum acceptance, optional tags, fetch validation, Unicode-normalized filename lookup, validation modes, and error details. It intentionally identifies itself in `Bag-Software-Agent`, creates valid empty manifests for empty bags, rejects additional unsafe or ambiguous archive paths, and does not reproduce Python's process-management internals or CLI. Tag-manifest entry ordering is deterministic here; Python's ordering depends on filesystem enumeration. Supply identical metadata when comparing generated bag bytes.
242
+
243
+ Reading existing tag encodings uses Node's built-in `TextDecoder`, with strict UTF-8, ASCII and ISO-8859-1 handling. Saving supports UTF-8, UTF-16 and representable single-byte encodings. Python-specific codecs and legacy multibyte encoding output are not provided; new bags always use UTF-8.
244
+
245
+ ## License
246
+
247
+ MIT. See [LICENSE](LICENSE) and [NOTICE](NOTICE). The reference Python project declares its code public domain.
@@ -0,0 +1,59 @@
1
+ import type { BagInfo, Entries, FetchEntry, MakeBagOptions, SaveOptions, ValidationOptions } from './types.js';
2
+ export declare class Bag {
3
+ readonly path: string;
4
+ tags: BagInfo;
5
+ info: BagInfo;
6
+ entries: Entries;
7
+ algorithms: string[];
8
+ versionInfo: readonly [number, number];
9
+ version: string;
10
+ encoding: string;
11
+ tagFileName: string;
12
+ normalizedFilesystemNames: Record<string, string>;
13
+ normalizedManifestNames: Record<string, string>;
14
+ /** Reads declaration, metadata and manifests synchronously; file hashing is asynchronous. */
15
+ constructor(path: string);
16
+ toString(): string;
17
+ get algs(): string[];
18
+ get version_info(): readonly [number, number];
19
+ get tag_file_name(): string;
20
+ private get verifiesTagFiles();
21
+ manifestFiles(): Generator<string>;
22
+ tagmanifestFiles(): Generator<string>;
23
+ private loadManifests;
24
+ payloadFiles(): Generator<string>;
25
+ payloadEntries(): Entries;
26
+ tagfileEntries(): Entries;
27
+ missingOptionalTagfiles(): Generator<string>;
28
+ compareManifestsWithFs(): [string[], string[]];
29
+ fetchEntries(): Generator<FetchEntry>;
30
+ filesToBeFetched(): Generator<string>;
31
+ compareFetchWithFs(): string[];
32
+ validateFetch(): void;
33
+ hasOxum(): boolean;
34
+ validate(options?: ValidationOptions): Promise<true>;
35
+ private validateOxum;
36
+ isValid(options?: ValidationOptions): Promise<boolean>;
37
+ save(options?: SaveOptions): Promise<void>;
38
+ manifest_files: () => Generator<string>;
39
+ tagmanifest_files: () => Generator<string>;
40
+ payload_files: () => Generator<string>;
41
+ payload_entries: () => Entries;
42
+ tagfile_entries: () => Entries;
43
+ missing_optional_tagfiles: () => Generator<string>;
44
+ compare_manifests_with_fs: () => [string[], string[]];
45
+ compare_fetch_with_fs: () => string[];
46
+ fetch_entries: () => Generator<FetchEntry>;
47
+ files_to_be_fetched: () => Generator<string>;
48
+ validate_fetch: () => void;
49
+ has_oxum: () => boolean;
50
+ is_valid: (options?: ValidationOptions) => Promise<boolean>;
51
+ }
52
+ /** Convert a directory in place. Existing contents, including an existing data/, become payload. */
53
+ export declare function makeBag(directory: string, options?: MakeBagOptions): Promise<Bag>;
54
+ export declare function makeManifests(root: string, options?: Pick<MakeBagOptions, 'checksums' | 'concurrency' | 'signal'>, encoding?: string): Promise<{
55
+ bytes: bigint;
56
+ files: number;
57
+ }>;
58
+ export declare function makeTagManifests(root: string, algorithms?: readonly string[], encoding?: string, signal?: AbortSignal): Promise<void>;
59
+ //# sourceMappingURL=bag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bag.d.ts","sourceRoot":"","sources":["../../src/bag.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAa,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAQ1H,qBAAa,GAAG;IACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,CAAuB;IACpC,IAAI,EAAE,OAAO,CAAuB;IACpC,OAAO,EAAE,OAAO,CAAuB;IACvC,UAAU,EAAE,MAAM,EAAE,CAAM;IAC1B,WAAW,EA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