dat-folder-archive
Creates an archive in a folder using the .dat
folder database.
- Creates an archive with base as
dir
- Create/Open a level db in
dir/.dat
- Resumes existing archives
Similar to dat-folder-db, but also creates an archive and saves the key to the database.
Usage
Use dat-folder-archive
to create a .dat
folder and get the archive & database to be used in other modules.
For example, to import the current directory, share it over the dat network, and track the stats:
var folderArchive = var hyperdiscovery = var hyperstats = var hyperimport = var dir = process
API
datFolderArchive(directory, [opts], callback)
Creates a hyperdrive archive in directory
, including making a .dat
database, using dat-folder-db.
The callback returns cb(err, archive, db)
.
Options are passed to hyperdrive. They can include:
opts = live: true // archive is live resume: null // force resume (see below) file: // file option for hyperdrive archive
Creating and Resuming an Archive
The .dat
folder can be used to persist an archive in a folder. When creating a new archive in a directory, use opts.resume
to specify what you're expecting in the folder:
resume = false
: create an archive only if no archive exists in the given directory.resume = true
: resume an archive only if it already exists and, if specified,opts.key
matches the key in the.dat
folder.resume = null
(default): create or resume an archive. Ifopts.key
is specified, check to make sure key matches.
The callback will set archive.resumed = true
if the archive was resumed, not newly created.
License
MIT