diff options
author | karissa <krmckelv@gmail.com> | 2016-05-24 11:42:26 -0700 |
---|---|---|
committer | karissa <krmckelv@gmail.com> | 2016-05-24 11:42:26 -0700 |
commit | 79ade9c827006bc7d4ed023a3c7716a4b82b3f04 (patch) | |
tree | 688da14eb2043d8d505b5ef0f9c7c31a83bbae66 | |
parent | 1534c09736f07f7017e4a4861ac42c50f1d6938d (diff) | |
download | dat-docs-79ade9c827006bc7d4ed023a3c7716a4b82b3f04.tar.gz dat-docs-79ade9c827006bc7d4ed023a3c7716a4b82b3f04.zip |
update api.md to reflect dat-server changes
-rw-r--r-- | api.md | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -3,10 +3,9 @@ ![dat-arch.001.jpg](arch.png) - * dat: command-line + * dat: command-line api * dat-desk: desktop application - * dat-server: http and ui frontend - * dat-js: JS api + * dat-server: js api for server daemon * hyperdrive: storage layer * discovery-swarm: swarm @@ -21,7 +20,7 @@ Create a new link for the contents of a directory and begin automatically servin * `--foreground`: run the server in the foreground instead. -#### `dat download LINK DIR` +#### `dat LINK DIR` Download a link to a directory and begin automatically serving the data to a swarm in the background. @@ -50,12 +49,12 @@ View a static list of the current dat links that are served. 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. -## dat-js +## JS api A common JavaScript API for Dat. ``` -var Dat = require('dat-js') +var Dat = require('dat-server') ``` #### `var dat = Dat(opts, cb)` @@ -83,9 +82,9 @@ linker.on('progress', function (progress) { }) ``` -#### `dat.download(link, dir, cb)` +#### `dat.join(link, cb)` -Download the given link to a given location. Get progress events from the stream. Progress events are the same as emitted by the `dat` object. +Join a swarm for the given link. Should be called after `link` or `download`. Throws error if data has not been downloaded or linked. ```js var done = function (err) { @@ -100,10 +99,6 @@ downloader.on('progress', function (progress) { }) ``` -#### `dat.join(link, cb)` - -Join a swarm for the given link. Should be called after `link` or `download`. Throws error if data has not been downloaded or linked. - #### `dat.leave(link, cb)` Leave the swarm for the given link. |