Skip to content

Commit

Permalink
fix download and improve share a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
joehand committed Mar 22, 2018
1 parent 7ddf587 commit 513a1dc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 115 deletions.
17 changes: 11 additions & 6 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ function runDat () {
}

var network = dat.joinNetwork()
network.once('connection', function () {
console.log('new connection')
})

if (dat.owner) share()
else download()
else {
network.once('connection', function () {
console.log('connected to peer!')
download()
})
}

function download () {
console.log(`Downloading: ${dat.key.toString('hex')}`)
Expand All @@ -60,7 +62,10 @@ function runDat () {
}

function share () {
console.log('sharing', path.resolve(src))
network.on('connection', function () {
console.log('new connection')
})
console.log('Sharing', path.resolve(src))

var progress = dat.importFiles(src, {
ignore: ['node_modules', '.dat']
Expand All @@ -72,7 +77,7 @@ function runDat () {
console.log('Added', dest.name)
})

console.log(`Sharing: ${dat.key.toString('hex')}\n`)
console.log(`KEY: ${dat.key.toString('hex')}\n`)
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ function run (src, dest, opts, cb) {
return cb(new Error('Invalid dat link'))
}
src = null

opts.sparse = true
opts.temp= true // use memory for downloads right now
}

Expand All @@ -28,7 +30,6 @@ function run (src, dest, opts, cb) {
return cb(new Error('Not archive owner and no destination provided.'))
}

dat.joinNetwork()
// TODO
// dat.trackStats()
// if (dat.owner) {
Expand Down
106 changes: 1 addition & 105 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ The next version of the `dat` command line tool.

Current version at [datproject/dat](https://github.com/datproject/dat).

**Warning: many bugs and not stable. May delete all your data!**

#### Known Bugs:

* Not really much UI
* Resuming doesn't work
* weird importing stuff going on
* No files storage
- sharing: files copied to db storage (takes up double size on HD)
- downloading: db in memory and copied to files

## Install:

```
Expand All @@ -18,13 +29,11 @@ npm install -g dat-next

```
dat-next <dir> [options]
--temp,-t keep sleep data in memory
--watch, -w watch folder for changes + auto import
--temp,-t keep data in memory
```

### Download `key` to `dir`:

```
dat-next <key> <dir> [options]
--live keep running + update changes
```

0 comments on commit 513a1dc

Please sign in to comment.