Skip to content

Commit 63ea6c1

Browse files
okdistributejoehandVirtualWolfelamjeagashlin
authored
Dat v14 -- breaking changes (#1173)
The *network* of dat v14 will not be compatible with earlier versions of dat. The .dat metadata file will still work, but older clients should upgrade to v14. It will have big improvements: * Better connectivity: A better DHT and holepunching. The networking stack has been entirely rewritten. See https://github.com/hyperswarm/hyperswarm * Deprecating the `dat share` command. Now, `dat share` and `dat sync` do the same thing, so you no longer have to remember if your directory has a dat in it already. Co-authored-by: Joe Hand <[email protected]> Co-authored-by: VirtualWolf <[email protected]> Co-authored-by: John <[email protected]> Co-authored-by: Adam Gashlin <[email protected]> Co-authored-by: Bohyun Jung <[email protected]>
1 parent d99c482 commit 63ea6c1

File tree

12 files changed

+1389
-1824
lines changed

12 files changed

+1389
-1824
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ language: node_js
22

33
node_js:
44
- 'lts/*'
5-
- '8'
6-
- '10'
5+
- '12'
76
- 'node'
87
sudo: false
98

@@ -30,5 +29,5 @@ deploy:
3029
file: dist/*
3130
on:
3231
repo: datproject/dat
33-
node: '10'
32+
node: '12'
3433
tags: true

README.md

Lines changed: 25 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -105,33 +105,35 @@ A dat is some files from your computer and a `.dat` folder. Each dat has a uniqu
105105

106106
### Sharing Data
107107

108-
You can start sharing your files with a single command. Unlike `git`, you do not have to initialize a repository first, `dat share` will do that for you:
108+
You can start sharing your files with a single command. Unlike `git`, you do not have to initialize a repository first, `dat share` or simply `dat` will do that for you:
109109

110110
```
111-
dat share <dir>
111+
dat <dir>
112112
```
113113

114-
Use `dat share` to create a dat and sync your files from your computer to other users. Dat scans your files inside `<dir>`, creating metadata in `<dir>/.dat`. Dat stores the public link, version history, and file information inside the dat folder.
114+
Use `dat` to create a dat and sync your files from your computer to other users. Dat scans your files inside `<dir>`, creating metadata in `<dir>/.dat`. Dat stores the public link, version history, and file information inside the dat folder.
115115

116+
`dat sync` and `dat share` are aliases for the same command.
116117
![share-gif]
117118

118119
### Downloading Data
119120

120121
```
121-
dat clone dat://<link> <download-dir>
122+
dat dat://<link> <download-dir>
122123
```
123124

124-
Use `dat clone` to download files from a remote computer sharing files with Dat. This will download the files from `dat://<link>` to your `<download-dir>`. The download exits after it completes but you can continue to update the files later after the clone is done. Use `dat pull` to update new files or `dat sync` to live sync changes.
125+
Use `dat` to download files from a remote computer sharing files with Dat. This will download the files from `dat://<link>` to your `<download-dir>`. The download exits after it completes but you can continue to update the files later after the clone is done. Use `dat pull` to update new files or `dat sync` to live sync changes.
126+
127+
`dat clone` is an alias for the same command.
125128

126129
![clone-gif]
127130

128-
Try out `dat clone` with the link above to read more about the protocol!
129131

130-
### Other Cool Commands
132+
### Misc Commands
131133

132134
A few other highlights. Run `dat help` to see the full usage guide.
133135

134-
* `dat create` - Create an empty dat and `dat.json` file.
136+
* `dat create` or `dat init` - Create an empty dat and `dat.json` file.
135137
* `dat doctor` - Dat network doctor! The doctor tries to connect to a public peer. The doctor also creates a key to test direct connections.
136138
* `dat log ~/data/dat-folder/` or `dat log dat://<key>` - view the history and metadata information for a dat.
137139

@@ -173,18 +175,16 @@ First, you can create a new dat inside that folder. Using the `dat create` comma
173175
❯ dat create
174176
Welcome to dat program!
175177
You can turn any folder on your computer into a Dat.
176-
A Dat is a folder with some magic.
178+
A dat is a folder with some magic.
177179
```
178180

179181
This will create a new (empty) dat. Dat will print a link, share this link to give others access to view your files.
180182

181-
Once we have our dat, run `dat share` to scan your files and sync them to the network. Share the link with your friend to instantly start downloading files.
182-
183-
You can also try viewing your files online. Go to [datbase.org](https://datbase.org) and enter your link to preview on the top left. *(Some users, including me when writing this, may have trouble connecting to datbase.org initially. Don't be alarmed! It is something we are working on. Thanks.)*
183+
Once we have our dat, run `dat <dir>` to scan your files and sync them to the network. Share the link with your friend to instantly start downloading files.
184184

185185
#### Bonus HTTP Demo
186186

187-
Dat makes it really easy to share live files on a HTTP server. This is a cool demo because we can also see how version history works! Serve dat files on HTTP with the `--http` option. For example, `dat sync --http`, serves your files to a HTTP website with live reloading and version history! This even works for dats you're downloading (add the `--sparse` option to only download files you select via HTTP). The default HTTP port is 8080.
187+
Dat makes it really easy to share live files on a HTTP server. This is a cool demo because we can also see how version history works! Serve dat files on HTTP with the `--http` option. For example, `dat --http`, serves your files to a HTTP website with live reloading and version history! This even works for dats you're downloading (add the `--sparse` option to only download files you select via HTTP). The default HTTP port is 8080.
188188

189189
*Hint: Use `localhost:8080/?version=10` to view a specific version.*
190190

@@ -223,7 +223,7 @@ dat create -y
223223
The quickest way to get started sharing files is to `share`:
224224

225225
```
226-
❯ dat share
226+
❯ dat
227227
dat://3e830227b4b2be197679ff1b573cc85e689f202c0884eb8bdb0e1fcecbd93119
228228
Sharing dat: 24 files (383 MB)
229229
@@ -234,24 +234,18 @@ Importing 528 files to Archive (165 MB/s)
234234
ADD: data/expn_cd.csv (403 MB / 920 MB)
235235
```
236236

237-
#### Syncing to Network
238-
239237
```
240-
dat sync [<dir>] [--no-import] [--no-watch]
238+
dat [<dir>] [--no-import] [--no-watch]
241239
```
242240

243-
Start sharing your dat archive over the network.
244-
Sync will import new or updated files since you last ran `create` or `sync`.
245-
Sync watches files for changes and imports updated files.
241+
Start sharing your dat archive over the network. It will import new or updated files since you last ran `create` or `sync`. Dat watches files for changes and imports updated files.
246242

247243
* Use `--no-import` to not import any new or updated files.
248244
* Use `--no-watch` to not watch directory for changes. `--import` must be true for `--watch` to work.
249245

250246
#### Ignoring Files
251247

252-
By default, Dat will ignore any files in a `.datignore` file, similar to git. Each file should be separated by a newline. Dat also ignores all hidden folders and files.
253-
254-
Dat uses [dat-ignore] to decide if a file should be ignored. Supports pattern wildcards (`/*.png`) and directory-wildcards (`/**/cache`).
248+
By default, Dat will ignore any files in a `.datignore` file, similar to git. Each file should be separated by a newline. Dat also ignores all hidden folders and files. Supports pattern wildcards (`/*.png`) and directory-wildcards (`/**/cache`).
255249

256250
#### Selecting Files
257251

@@ -260,22 +254,23 @@ By default, Dat will download all files. If you want to only download a subset,
260254

261255
### Downloading
262256

263-
Start downloading by running the `clone` command. This creates a folder, downloads the content and metadata, and a `.dat` folder inside. Once you started the download, you can resume using `clone` or the other download commands.
257+
Start downloading by running the `clone` command. This creates a folder, downloads the content and metadata, and a `.dat` folder inside. Once you started the download, you can resume at any time.
264258

265259
```
266-
dat clone <link> [<dir>] [--temp]
260+
dat <link> [<dir>] [--temp]
267261
```
268262

269263
Clone a remote dat archive to a local folder.
270264
This will create a folder with the key name if no folder is specified.
271265

266+
272267
#### Downloading via `dat.json` key
273268

274269
You can use a `dat.json` file to clone also. This is useful when combining Dat and git, for example. To clone a dat you can specify the path to a folder containing a `dat.json`:
275270

276271
```
277-
git clone [email protected]:joehand/dat-clone-sparse-test.git
278-
dat clone ./dat-clone-sparse-test
272+
git [email protected]:joehand/dat-clone-sparse-test.git
273+
dat ./dat-clone-sparse-test
279274
```
280275

281276
This will download the dat specified in the `dat.json` file.
@@ -288,60 +283,20 @@ Once a dat is clone, you can run either `dat pull` or `dat sync` in the folder t
288283
dat pull [<dir>]
289284
```
290285

291-
Update a cloned dat archive with the latest files and exit.
292-
293-
```
294-
dat sync [<dir>]
295-
```
296-
297286
Download latest files and keep connection open to continue updating as remote source is updated.
298287

299288
### Shortcut commands
300289

301290
* `dat <link> <dir>` will run `dat clone` for new dats or resume the existing dat in `<dir>`
302291
* `dat <dir>` is the same as running `dat sync <dir>`
303292

304-
### Dat Registry and Authentication
305-
306-
As part of our [Knight Foundation grant], we are building a registry for dat archives.
307-
We will be running a dat registry at datbase.org, but anyone will be able to create their own.
308-
Once registered, you will be able to publish dat archives from our registry.
309-
Anyone can clone archives published to a registry without registration:
310-
311-
```
312-
dat clone datbase.org/jhand/cli-demo
313-
```
314-
315-
#### Auth (experimental)
316-
317-
You can also use the `dat` command line to register and publish to dat registries. Dat plans to support any registry. Currently, `datbase.org` is the only one available and the default.
318-
319-
To register and login you can use the following commands:
320-
321-
```
322-
dat register [<registry>]
323-
dat login
324-
dat whoami
325-
```
326-
327-
Once you are logged in to a registry, you can publish a dat archive:
328-
329-
```
330-
cd my-data
331-
dat create
332-
dat publish --name my-dataset
333-
```
334-
335-
All registry requests take the `<registry>` option if you'd like to publish to a different registry than datbase.org.
336-
You can deploy your own compatible [registry server] if you'd rather use your own service.
337-
338293
### Key Management & Moving dats
339294

340295
`dat keys` provides a few commands to help you move or backup your dats.
341296

342297
Writing to a dat requires the secret key, stored in the `~/.dat` folder. You can export and import these keys between dats. First, clone your dat to the new location:
343298

344-
* (original) `dat share`
299+
* (original) `dat share`
345300
* (duplicate) `dat clone <link>`
346301

347302
Then transfer the secret key:
@@ -366,7 +321,7 @@ Check your Dat version:
366321
dat -v
367322
```
368323

369-
You should see the Dat semantic version printed, e.g. `13.1.2`.
324+
You should see the Dat semantic version printed, e.g. `14.0.0`.
370325

371326
### Installation Issues
372327

@@ -396,7 +351,7 @@ If you are having trouble with a specific command, run with the debug environmen
396351
This will help us debug any issues:
397352

398353
```
399-
DEBUG=dat,dat-node dat clone dat://<link> dir
354+
DEBUG=dat,dat-node dat dat://<link> dir
400355
```
401356

402357
### Networking Issues

bin/cli.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ var config = {
6060
commands: [
6161
require('../src/commands/clone'),
6262
require('../src/commands/create'),
63-
require('../src/commands/doctor'),
6463
require('../src/commands/log'),
6564
require('../src/commands/keys'),
6665
require('../src/commands/publish'),
6766
require('../src/commands/pull'),
68-
require('../src/commands/share'),
6967
require('../src/commands/status'),
7068
require('../src/commands/sync'),
7169
require('../src/commands/unpublish'),
@@ -82,7 +80,8 @@ var config = {
8280
}
8381
},
8482
aliases: {
85-
'init': 'create'
83+
'init': 'create',
84+
'share': 'sync'
8685
},
8786
// whitelist extensions for now
8887
extensions: [
@@ -139,7 +138,7 @@ function syncShorthand (opts) {
139138
// Set default opts. TODO: use default opts in share
140139
opts.watch = opts.watch || true
141140
opts.import = opts.import || true
142-
return require('../src/commands/share').command(opts)
141+
return require('../src/commands/sync').command(opts)
143142
}
144143

145144
// All else fails, show usage

0 commit comments

Comments
 (0)