-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get following and handshakes working properly using node forks in the…
… tests. To get things to work, I had to use some funky download code i found in dat-node/examples
- Loading branch information
1 parent
8a0e975
commit 9367862
Showing
9 changed files
with
112 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
npm-debug.log | ||
test/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const createDir = require('./utils/create-dir') | ||
const path = require('path') | ||
const mirror = require('mirror-folder') | ||
const fs = require('fs') | ||
const Dat = require('dat-node') | ||
const ram = require('random-access-memory') | ||
|
||
// Download an archive, calling cb when it is completed | ||
|
||
module.exports = function download (key, dest, cb) { | ||
createDir(dest) | ||
Dat(ram, {key, sparse: true}, function (err, dat) { | ||
if (err) throw err | ||
const dload = () => { | ||
const progress = mirror({fs: dat.archive, name: '/'}, dest, (err) => { | ||
if (err) throw err | ||
dat.close() | ||
cb(dat) | ||
}) | ||
} | ||
const network = dat.joinNetwork() | ||
dat.archive.metadata.update(dload) | ||
}) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.