Archive tools
Back up nsites and other files, keep versions, recognize duplicate content and reconstruct original bytes when you need them.
Try it in context: Read the guide.
import { Archive } from '@chaoticka/nsite-loopy-sdk';
What you can call (13)
GEAR_PROFILE
The size limits and identifier for Loopy’s internal content-defined chunking strategy.
Call it as: Archive.GEAR_PROFILE
For developers: TypeScript signature
const GEAR_PROFILE: Readonly<{id:string;min:number;avg:number;max:number}>;
Code location: src/archive/chunks.js
buildArchiveCatalog
Make a searchable catalog of archived site versions and their relationships.
Call it as: Archive.buildArchiveCatalog
For developers: TypeScript signature
function buildArchiveCatalog(versions:object[],options?:object):object;
Code location: src/archive/catalog.js
chunkManifest
Split file bytes into reusable chunks and record their hashes in a manifest.
Call it as: Archive.chunkManifest
For developers: TypeScript signature
function chunkManifest(data:Uint8Array,options?:{hash?:(data:Uint8Array)=>Promise<Hex>}):Promise<{profile:string;size:number;hash:Hex;chunks:Array<{hash:Hex;size:number}>}>;
Code location: src/archive/chunks.js
contentStore
Store and retrieve unique file contents by their SHA-256 fingerprints.
Call it as: Archive.contentStore
For developers: TypeScript signature
function contentStore(storage?:StorageAdapter):{put(data:string|Uint8Array):Promise<{hash:Hex;size:number}>;get(hash:Hex):Promise<Uint8Array|null>;verify(hash:Hex):Promise<boolean>;saveManifest(id:string,manifest:object):Promise<void>;loadManifest(id:string):Promise<unknown>;keys():Promise<string[]>};
Code location: src/archive/content-addressable.js
crc32
Calculate the checksum used by ZIP archives to detect accidental corruption.
Call it as: Archive.crc32
For developers: TypeScript signature
function crc32(data:string|Uint8Array):number;
Code location: src/archive/zip.js
diffVersions
Compare two saved site versions to see which files changed.
Call it as: Archive.diffVersions
For developers: TypeScript signature
function diffVersions(a:{files:Array<{path:string;hash:Hex}>},b:{files:Array<{path:string;hash:Hex}>}):object[];
Code location: src/archive/versions.js
gearChunks
Split a file into reusable chunks using stable content-defined boundaries.
Call it as: Archive.gearChunks
For developers: TypeScript signature
function gearChunks(data:Uint8Array):Uint8Array[];
Code location: src/archive/chunks.js
groupVersions
Group archived versions by publisher and site identity.
Call it as: Archive.groupVersions
For developers: TypeScript signature
function groupVersions(versions:object[]):Map<string,object[]>;
Code location: src/archive/versions.js
materializeVersion
Reconstruct the exact files for a chosen saved site version.
Call it as: Archive.materializeVersion
For developers: TypeScript signature
function materializeVersion(manifest:{files:Array<{path:string;hash:Hex}>},store:ReturnType<typeof contentStore>):Promise<Record<string,Uint8Array>>;
Code location: src/archive/versions.js
readZip
Read a ZIP safely, checking for corruption, unsafe paths and oversized extraction.
Call it as: Archive.readZip
For developers: TypeScript signature
function readZip(data:Uint8Array,options?:{maxFiles?:number;maxOutputBytes?:number;maxRatio?:number;inflate?:(data:Uint8Array)=>Promise<Uint8Array>}):Promise<Record<string,Uint8Array>>;
Code location: src/archive/zip.js
restoreChunkManifest
Reassemble a file from its recorded chunks and verify the result.
Call it as: Archive.restoreChunkManifest
For developers: TypeScript signature
function restoreChunkManifest(manifest:{profile:string;size:number;hash:Hex;chunks:Array<{hash:Hex;size:number}>},read:(hash:Hex)=>Promise<Uint8Array>,options?:object):Promise<Uint8Array>;
Code location: src/archive/chunks.js
searchArchive
Search saved site versions using text and filter options.
Call it as: Archive.searchArchive
For developers: TypeScript signature
function searchArchive(catalog:object,options?:object):{total:number;rows:object[]};
Code location: src/archive/catalog.js
writeZip
Create a reproducible ZIP from a map of files.
Call it as: Archive.writeZip
For developers: TypeScript signature
function writeZip(files:FileMap,options?:{maxFiles?:number;maxBytes?:number}):Uint8Array;
Code location: src/archive/zip.js