Skip to content

Minima.js API


Minima.js API / @minimajs/disk / snapshot / snapshot

Function: snapshot() ​

ts
function snapshot(
   src, 
   dest, 
options?): Promise<string>;

Snapshot files from src into a single streaming ZIP on dest. No files are buffered in memory — data streams directly through the ZIP encoder. Compression, encryption, and other transforms are handled by plugins on dest.

Parameters ​

src ​

Disk

dest ​

Disk

options? ​

SnapshotOptions = {}

Returns ​

Promise<string>

Example ​

ts
// Simple local → S3 backup
const snapshotId = await snapshot(localDisk, s3Disk)

// Snapshot a specific path
const snapshotId = await snapshot(localDisk, s3Disk, { path: 'uploads/' })

// With encryption on dest via plugin
const secureDisk = createDisk(s3Driver, encrypt({ password }))
const snapshotId = await snapshot(localDisk, secureDisk)