aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: a259a2cb89941e1a7b370f13c9107c3ac7f1a42c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Dat 1.0 docs

Documentation resources for [dat](https://github.com/maxogden/dat) 1.0 release candidate 1 and the surrounding ecosystem.

## Installation

```
npm install -g dat@next
```

## Sharing data

Dat is a peer to peer file sharing tool. To share data, first `cd` into a directory you want to share, and type:

```
$ dat link
```

This will create a link, that looks like `dat://...`. This is a unique hash, generated by the contents of the files (including those in subdirectories) inside the current directory. Dat ignores hidden files.

Your output might look something like this:

```
$ dat link
Scanning folder, found 98 files in 5 directories. 47.12 MB total.
dat://a9933c3d00e1134e5814a0fe2b0f1166885f523dfe0d135a39a2ca4b43840d83
Serving data (1 connection(s))
```

The data will now available on the Internet. If I want to share this data with someone else, I'll need to open port 3282 (DATA) on my local network.

On another computer, I can type:

```
dat dat://a9933c3d00e1134e5814a0fe2b0f1166885f523dfe0d135a39a2ca4b43840d83
```

And the files will be downloaded inside of the current directory. The process will stay open, re-hosting the data to ensure redundancy of the data.

## Versioning

If you change any file inside the directory, you will get a different link. Each link is unique to the file list and data contents inside each file.

Everything about the filesystem is replicated between two dat hosts, including directory structure, file modes, and time modified (mtime), among other filesystem metadata (TODO: link to more info here). For example, changing the file mode of a single file will create an entirely different link.

## Hosting

By default, dat looks to host on port 3282, and if taken, will choose a random open port.

## Local storage

Dat stores its data in a hidden folder that is stored by default in the user's home directory.

```
~/.dat
```

Because of this, data is only ever downloaded once. That is, if you have multiple projects that use the same data (perhaps at different versions) on the same machine, dat will first check the global `.dat` folder.

The global `.dat` folder has inside:

```
$ ls ~/.dat
db
config.json
```

## Dat dependency overview

#### [hyperdrive](https://github.com/mafintosh/hyperdrive)

The file sharing network dat uses to distribute files and data. A technical specification / discussion on how hyperdrive works is [available here](https://github.com/mafintosh/hyperdrive/blob/master/SPECIFICATION.md)

#### [discovery-channel](https://github.com/maxogden/discovery-channel)

This is the module dat uses to find peers on the local network or the internet who are sharing the same files and data that you are.