{
sparse: true, // only download data on content feed when it is specifically requested
sparseMetadata: true// only download data on metadata feed when requested
metadataStorageCacheSize: 65536// how many entries to use in the metadata hypercore's LRU cache
contentStorageCacheSize: 65536// how many entries to use in the content hypercore's LRU cache
treeCacheSize: 65536// how many entries to use in the append-tree's LRU cache
}

Note that a cloned hyperdrive archive can be "sparse". Usually (by setting sparse: true) this means that the content is not downloaded until you ask for it, but the entire metadata feed is still downloaded. If you want a very sparse archive, where even the metadata feed is not downloaded until you request it, then you should also set sparseMetadata: true.

archive.version

archive.key

archive.discoveryKey

A key derived from the public key that can be used to discovery other peers sharing this archive.

archive.writable

A boolean indicating whether the archive is writable.

archive.on('ready')

Emitted when the archive is fully ready and all properties has been populated.

archive.on('error', err)

Emitted when a critical error during load happened.

var oldDrive = archive.checkout(version, [opts])

Checkout a readonly copy of the archive at an old version. Options are used to configure the oldDrive:

{
metadataStorageCacheSize: 65536// how many entries to use in the metadata hypercore's LRU cache
contentStorageCacheSize: 65536// how many entries to use in the content hypercore's LRU cache
treeCacheSize: 65536// how many entries to use in the append-tree's LRU cache
}

archive.download([path], [callback])

Download all files in path of current version.
If no path is specified this will download all files.

You can use this with .checkout(version) to download a specific version of the archive.

var stream = archive.createWriteStream(name, [options])

Write a file as a stream. Similar to fs.createWriteStream.
If options.cached is set to true, this function returns results only if they have already been downloaded.

archive.writeFile(name, buffer, [options], [callback])

Write a file from a single buffer. Similar to fs.writeFile.

archive.unlink(name, [callback])

Unlinks (deletes) a file. Similar to fs.unlink.

archive.mkdir(name, [options], [callback])

Explictly create an directory. Similar to fs.mkdir

archive.rmdir(name, [callback])

Delete an empty directory. Similar to fs.rmdir.

archive.readdir(name, [options], [callback])

Lists a directory. Similar to fs.readdir.

Options include:

{
cached: true|false, // default: false
}

If cached is set to true, this function returns results from the local version of the archive’s append-tree. Default behavior is to fetch the latest remote version of the archive before returning list of directories.