Skip to content

Commit

Permalink
require('dat') to get dat-node (#778)
Browse files Browse the repository at this point in the history
* add require dat-node

* standard
  • Loading branch information
joehand authored May 23, 2017
1 parent aeefc78 commit 528b282
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The [Dat Project](http://datproject.org) is the home to open source data sharing
* [Dat Desktop](https://datproject.org/install#desktop) - A desktop app to manage multiple Dats on your desktop machine.
* [Beaker Browser](http://beakerbrowser.com) - An experimental p2p browser with built-in support for the Dat protocol.
* [Dat Protocol](https://www.datprotocol.com) - Build your own application on the Decentralized Archive Transport (Dat) protocol.
* [require('dat-node')](http://github.com/datproject/dat-node) - Node.js library for downloading and sharing Dat archives.
* [require('dat')](http://github.com/datproject/dat-node) - Node.js library for downloading and sharing Dat archives.

---

Expand Down Expand Up @@ -382,6 +382,20 @@ The doctor will run through the key steps in the process of sharing data between

---

## JS API

You can use Dat in your javascript application:

```js
var Dat = require('dat')

Dat('/data', function (err, dat) {
// use dat
})
```

**[Read more](https://github.com/datproject/dat-node) about the JS usage provided via `dat-node`.**

## For Developers

Please see [guidelines on contributing](https://github.com/datproject/dat/blob/master/CONTRIBUTING.md) before submitting an issue or PR.
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('dat-node')
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"decentralized",
"file sharing"
],
"main" : "index.js",
"bin": {
"dat": "bin/cli.js"
},
Expand Down
12 changes: 12 additions & 0 deletions test/dat-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var test = require('tape')
var ram = require('random-access-memory')
var Dat = require('..')

test('dat-node: require dat-node + make a dat', function (t) {
Dat(ram, function (err, dat) {
t.error(err, 'no error')
t.ok(dat, 'makes dat')
t.pass('yay')
t.end()
})
})

0 comments on commit 528b282

Please sign in to comment.