dat-api

1.1.2 • Public • Published

dat-api

A pure JavaScript browser-friendly api for using dat.

Travis NPM version

API

var dat = new Dat([options])

Creates a new dat object. The options passed here will be default for any dats created using the add method.

dat.add(key, [options], [onrepo])

Adds a new dat with the given key. Joins the appropriate swarm for that key and begins to upload and download data. The onrepo function will be called when the dat is finished being created.

  • key: the path on the filesystem to store data
  • options: These options will override any options given in the Dat constructor.

Properties

dat.repos

Array of repo instances

Repo

The repo object managed by dat.

repo.key

The key of the repo

repo.resume()

Joins the swarm for the repository, beginning to find peers in the network to share with.

repo.pause()

Pause syncing. This disconnects from any peers currently syncing data with the repo.

repo.destroy()

Destroys the swarm and underlying database.

repo.swarm

Get to the original discovery-swarm instance, where the swarm can be managed.

repo.archive

Get to the original hyperdrive archive instance, where files can be managed using that api.

Events

repo

Fired every time a new repo is ready.

close

Fired when dat is finished closing, including swarm and database.

Readme

Keywords

none

Package Sidebar

Install

npm i dat-api

Weekly Downloads

1

Version

1.1.2

License

BSD-2-Clause

Last publish

Collaborators

  • karissa