BagIt 1.0 archive package creation and validation for MoonBit
npm ci --ignore-scripts
moon check --target js
moon test --target js
moon build --target js
node bin/moonbagit.mjs create examples/payload example-bag --both --metadata examples/metadata.json
node bin/moonbagit.mjs validate example-bagexample-bag/
bagit.txt
bag-info.txt
manifest-sha256.txt
manifest-sha512.txt
tagmanifest-sha256.txt
tagmanifest-sha512.txt
data/
readme.txt
nested/measurement.csvmoon add zbhzs1/moonbagit@0.4.0moon run examples/core --target wasm-gc| Area | Current behavior |
|---|---|
| Declaration | BagIt 1.0; declaration always UTF-8 without BOM; remaining standard tags use its declared encoding |
| Payload manifests | SHA-256, SHA-512 and legacy MD5/SHA-1; every manifest covers every payload file exactly once |
| Tag manifests | Required payload-manifest coverage; forbid payload and tag-manifest references; check listed arbitrary tags |
| Metadata | Ordered/repeated fields, continuations; unique and numeric Payload-Oxum |
| Paths | / separators, normative %25, %0D, %0A; reject traversal, absolute, NUL and drive-qualified paths; ordinary POSIX colons/backslashes are not format errors |
| Checksums | Verify every supported manifest, including all tag manifests |
| Fetch | Complete RFC 3986 absolute-URI grammar, coverage/length checks and explicit HTTP(S) retrieval into a new staged output; no automatic URI execution during validation |
| Additional tags | Opaque content; verify if listed; unprotected tags produce warnings |
| Host safety | Reject symlinks and special files; no source overwrite; new output only |
| Receiving profiles | BagIt Profiles 1.4.0 rules for metadata, algorithms, fetch, files/directories and directory serialization constraints |
| Digest upgrade | Add supported manifests to a new output; retain payload, metadata and existing payload manifests; regenerate every tag manifest |
| Portability lint | Advisory device-name, trailing-character, case-collision and path-length diagnostics |
node bin/moonbagit.mjs create examples/payload research-bag --both --metadata examples/research-metadata.json --profile examples/research-profile.json
node bin/moonbagit.mjs validate research-bag --profile examples/research-profile.json
node bin/moonbagit.mjs lint research-bag
node bin/moonbagit.mjs create examples/payload sha256-bag --sha256
node bin/moonbagit.mjs upgrade sha256-bag upgraded-bag --sha512
node bin/moonbagit.mjs validate upgraded-bagnode bin/moonbagit.mjs fetch incoming-bag received-bag --allow-origin https://data.example.org --max-bytes 1073741824 --timeout-ms 30000 --profile examples/research-profile.jsonmoon test --target js
moon test --target wasm-gc
python -m pip install bagit==1.9.0
python scripts/interop.py
git -c core.autocrlf=false clone https://github.com/LibraryOfCongress/bagit-conformance-suite.git ../bagit-conformance-suite
git -C ../bagit-conformance-suite checkout 9ab48705c06664f9f419ca740c728c9f89a61e7c
python scripts/conformance.py ../bagit-conformance-suite
python scripts/benchmark.py --files 10000 --bytes 1024
python scripts/consumer.pypub(all) struct AcceptanceReport {
accepted : Bool
policy : String
bag : Report
diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct BagAudit {
report : Report
summary : AuditSummary
files : Array[FileAudit]
located_diagnostics : Array[LocatedDiagnostic]
} derive(ToJson)pub(all) struct BagSnapshot {
label : String
bag_version : String
encoding : String
directories : Array[String]
files : Array[FileRecord]
metadata : Array[Metadata]
}pub(all) struct ChecksumEvidence {
manifest : String
algorithm : String
expected : String
observed : String?
status : String
} derive(ToJson)pub(all) struct CollectionReport {
accepted : Bool
accepted_bags : Int
rejected_bags : Int
payload_files : Int64
payload_bytes : Int64
items : Array[CollectionResult]
} derive(ToJson)pub(all) struct CollectionResult {
identifier : String
acceptance : AcceptanceReport
} derive(ToJson)pub(all) struct DeliveryReport {
accepted : Bool
mode : String
source : Report
received : Report
preserved_files : Int
completed_files : Int
diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct FileAudit {
path : String
payload : Bool
present : Bool
size : Int64?
checksums : Array[ChecksumEvidence]
integrity_verified : Bool
} derive(ToJson)pub(all) struct LocatedDiagnostic {
path : String
line : Int
code : String
message : String
} derive(ToJson)pub(all) struct ManifestInspection {
name : String
parsed_entries : Array[Entry]
diagnostics : Array[LocatedDiagnostic]
}pub struct ManifestReader {
name : String
alg : Algorithm
tag : Bool
max_line_units : Int?
max_entries : Int?
entries : Array[Entry]
seen : Map[String, Bool]
buffer : StringBuilder
buffer_units : Int
line : Int
after_cr : Bool
finished : Bool
failure : String?
}pub(all) struct PathBudget {
pattern : String
max_files : Int64?
max_bytes : Int64?
}pub(all) struct PreservationReport {
preserved : Bool
bag : Report
inventory : SnapshotVerification
metadata : Array[MetadataChange]
declaration_matches : Bool
} derive(ToJson)pub(all) struct Profile {
identifier : String
version : String
metadata : Array[MetadataRule]
manifests_required : Array[String]
manifests_allowed : Array[String]?
tag_manifests_required : Array[String]
tag_manifests_allowed : Array[String]?
allow_fetch : Bool
require_fetch : Bool
data_empty : Bool
serialization : String
accepted_serializations : Array[String]
bag_versions : Array[String]
tags_required : Array[String]
tags_allowed : Array[String]
payload_required : Array[String]
payload_allowed : Array[String]
} derive(Debug)pub(all) struct ProfileReport {
conforms : Bool
bag : Report
diagnostics : Array[Diagnostic]
} derive(ToJson, Debug)pub(all) struct ReceivingPolicy {
name : String
payload_algorithms : Array[String]
tag_algorithms : Array[String]
forbid_legacy : Bool
require_tag_protection : Bool
require_portable : Bool
allow_empty : Bool
allow_fetch : Bool
max_payload_files : Int64?
max_payload_bytes : Int64?
max_file_bytes : Int64?
max_tag_bytes : Int64?
max_path_depth : Int64?
max_manifest_entries : Int64?
path_budgets : Array[PathBudget]
}pub(all) struct Report {
complete : Bool
valid : Bool
payload_files : Int
payload_bytes : Int64
verified_checksums : Int
diagnostics : Array[Diagnostic]
} derive(ToJson, Debug)pub(all) struct SnapshotDelta {
byte_identical : Bool
payload_identical : Bool
comparable : Bool
unchanged_files : Int
files : Array[FileChange]
directories_added : Array[String]
directories_removed : Array[String]
metadata : Array[MetadataChange]
declaration_changed : Bool
} derive(ToJson)pub(all) struct SnapshotVerification {
matches : Bool
checked_files : Int
verified_checksums : Int
diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct TransferBatch {
number : Int
reserved_bytes : Int64
tasks : Array[TransferTask]
} derive(ToJson)pub(all) struct TransferOptions {
allowed_schemes : Array[String]
max_total_bytes : Int64
max_file_bytes : Int64
max_batch_bytes : Int64
max_batch_files : Int
unknown_size_reservation : Int64?
}pub(all) struct TransferPlan {
pending_files : Int
known_bytes : Int64
reserved_bytes : Int64
unknown_sizes : Int
directories_to_create : Array[String]
batches : Array[TransferBatch]
} derive(ToJson)fn create_tag_manifests(tags : Array[FileRecord], algorithms? : Array[Algorithm]) -> Map[String, String] raise FormatErrorfn create_tags(payload : Array[FileRecord], metadata? : Array[Metadata], algorithms? : Array[Algorithm], encoding? : String) -> Map[String, String] raise FormatErrorfn evaluate_collection(collection : Array[CollectionItem], policy : ReceivingPolicy) -> CollectionReport raise FormatErrorfn evaluate_receiving_policy(view : BagView, policy : ReceivingPolicy) -> AcceptanceReport raise FormatErrorfn manifest_reader(name : String, max_line_units? : Int, max_entries? : Int) -> ManifestReader raise FormatErrorfn profile_path_matches(pattern : String, path : String) -> Boolfn revalidate_snapshot(expected : BagSnapshot, current : BagView) -> PreservationReport raise FormatErrorfn verify_snapshot_inventory(expected : BagSnapshot, observed : Array[FileRecord], directories : Array[String]) -> SnapshotVerification raise FormatErrorInstall
Download zipBagIt 1.0 archive package creation and validation for MoonBit