aboutsummaryrefslogtreecommitdiffstats
path: root/api.md
diff options
context:
space:
mode:
Diffstat (limited to 'api.md')
-rw-r--r--api.md101
1 files changed, 6 insertions, 95 deletions
diff --git a/api.md b/api.md
index 3c41cd9..bcff126 100644
--- a/api.md
+++ b/api.md
@@ -3,110 +3,21 @@
* dat: command-line api
* dat-desk: desktop application
- * dat-server: js api for server daemon
* hyperdrive: storage layer
- * discovery-swarm: swarm
-
+ * discovery-swarm: dat network swarm discovery mechanism
## dat
Command-line interface for dat
-#### `dat link DIR`
-
-Create a new link for the contents of a directory and begin automatically serving the data to a swarm in the background.
-
- * `--foreground`: run the server in the foreground instead.
-
#### `dat LINK DIR`
-Download a link to a directory and begin automatically serving the data to a swarm in the background.
-
- * `--foreground`: run the server in the foreground instead.
-
-#### `dat start`
-
-Starts serving dats in the background progress.
-
- * `--foreground`: run the server in the foreground instead.
-
-#### `dat status`
-
-View a static list of the current dat links that are served.
-
-#### `dat stop`
-
-Stops serving dats.
-
-#### `dat rm LINK`
-
-Remove a link from the list, stops serving it.
-
-#### `dat mon`
-
-Opens up real-time monitoring panel for viewing progress of running dats. Can provide optional parameter `dat mon LINK` to filter the monitor and logs for a given dat link.
-
-
-## JS api
-
-A common JavaScript API for Dat.
-
-```
-var Dat = require('dat-server')
-```
-
-#### `var dat = Dat(opts, cb)`
-
-Options
-
- * `db`: leveldb instance for underlying hyperdrive
- * `DISCOVERY_SERVER`: the discovery server to use. (default 'discovery1.publicbits.org')
- * `DAT_DOMAIN`: the domain to use (default 'dat.local')
-
-#### `dat.link(dir, cb)`
-
-Create a dat link for the given directory. Does not start sharing the dat. Must use `dat.join` to begin serving the link to the swarm.
-
-```js
-var linker = dat.link(dir)
-var done = function (err, link) {
- if (err) throw err
- console.log('Done linking!', link)
-}
-var dir = '/Users/karissa/data/mydata'
-var linker = dat.link(dir, done)
-linker.on('progress', function (progress) {
- console.log('progress item', progress)
-})
-```
-
-#### `dat.join(link, dir, cb)`
-
-Joins the swarm for a given link to a given location. Get progress events from the stream. Progress events are the same as emitted by the `dat` object.
-
-```js
-var done = function (err) {
- if (err) throw err
- console.log('Done downloading!')
-}
-var link = 'dat://8a82dae10ee8384'
-var dir = '/Users/karissa/data/mydata'
-var downloader = dat.download(link, dir, done)
-downloader.on('progress', function (progress) {
- console.log('progress item', progress)
-})
-```
-
-#### `dat.leave(link, cb)`
+Downloads the link to the given directory.
-Leave the swarm for the given link.
+#### `dat seed LINK DIR`
-#### `dat.on('progress', cb)`
+Downloads the link to the given directory and opens up a server that seeds it to the dat peer network.
-Get all progress events from uploading and downloading data.
+### `dat ls LINK`
-```js
-dat.on('progress', function (progress) {
- console.log(progress)
-})
-```
+Fetches the metadata for the link and prints out the file list in the console.