Dat is a decentralized data tool for distributing data small and large.
| Windows | Mac/Linux |
|---|---|
Documentation for the Dat project is available at docs.dat-data.com.
- Live sync folders by sharing files as they are added to the folder.
- Distribute large files without copying data to a central server by connecting directly to peers.
- Intelligently sync by deduplicating data between versions.
- Verify data integrity using strong cryptographic hashes.
- Work everywhere, including in the browser and on the desktop.
Dat embraces the Unix philosophy: a modular design with composable parts. All of the pieces can be replaced with alternative implementations as long as they implement the abstract API.
This is the Dat CLI 1.0 release candidate (RC2). We are actively seeking feedback & developing this release candidate. Follow this issue for the Dat CLI road map discussion and see known RC2 issues.
Please note that previous versions of Dat (alpha, beta) are incompatible with the 1.0 release candidate.
To install the 1.0 release candidate from npm:
npm install dat -g
If you receive an EACCES error read this guide.
There are two main commands in dat:
- Share data:
dat <directory> - Download data:
dat <dat-link> <download-directory>
Share a directory by typing dat <directory>:
$ dat my_data/
Sharing /Users/joe/my_data/
Share Link: d6e1875598fae25165eff440ffd01513197ad0db9dbb9898f2a141288b9322c6
The Share Link is secret and only those you share it with will be able to get the files
[==============>] Added 2 files (1.44 kB/1.44 kB)
Connected to 1 peers. Uploading 288.2 B/s. Watching for updates...
You are now publishing that data from your computer. It will be publicly accessible as long as your terminal is open. The hash is a secret hash, your data is visible to anyone you send the hash to. As you add more files to the folder, dat will update and share the new files.
Your colleague can get data like this:
$ dat d6e1875598fae25165eff440ffd01513197ad0db9dbb9898f2a141288b9322c6 download_dir
Downloading in /Users/joe/download_dir
Share Link: d6e1875598fae25165eff440ffd01513197ad0db9dbb9898f2a141288b9322c6
The Share Link is secret and only those you share it with will be able to get the files
[==============>] Downloaded 3 files (1.44 kB/1.44 kB)
Connected to 1 peers. Downloading 1.44 kB/s. Watching for updates...
It will start downloading the data into the download_dir folder. Anyone who gets access to the unique dat-link will be able to download and re-host a copy of the data. It's distributed mad science!
For more information, see the dat project documentation.
- Hyperdrive: on-disk database format
- Discovery Swarm: discovery mechanism
- dat-js: javascript library
- dat-desktop: desktop application
- dat.land: website application
Please see guidelines on contributing before submitting an issue or PR.
Clone this repository and in a terminal inside of the folder you cloned run this command:
npm link
This should add a dat command line command to your PATH. Now you can run the dat command to try it out.
The contribution guide also has more tips on our development workflow.
Note: we are in the process of moving the main library to a separate module, joehand/dat-js. Temp documentation here for developers.
download dat.key to dat.dir
share directory specified in opts.dir
Swarm is automatically joined for key when it is available for share & download (dat.joinSwarm()).
dat.on('ready'): db created/read & hyperdrive archive created.dat.on('error'): init/database error
Swarm events and stats are available from dat.swarm.
dat.on('connecting'): looking for peersdat.on('swarm-update'): peer number changed
dat.on('key'): key is available (this is at archive-finalized for snapshots)dat.on('append-ready'): file count available (dat.appendStats), about to start appending to hyperdrivedat.on('file-added'): file added to archivedat.on('upload', data): piece of data uploadeddat.on('archive-finalized'): archive finalized, all files appendeddat.on('archive-updated'): live archive changed
dat.on('key'): key is availabledat.on('file-downloaded', file): file downloadeddat.on('download', data): piece of data downloadeddat.on('upload', data): piece of data uploadeddat.on('download-finished'): archive download finished
dat.key: keydat.dir: directorydat.datPath: path to .dat folderdat.db: database instancedat.swarm: hyperdrive-archive-swarm instancedat.archive: hyperdrive archivedat.snapshot(boolean): sharing snapshot archive
dat.stats = {
filesTotal: 0, // Latest archive size
bytesTotal: 0,
bytesUp: 0,
bytesDown: 0,
rateUp: speedometer(),
rateDown: speedometer()
}
// Calculated on share before append starts. Used for append progress.
// Not updated for live.
dat.appendStats = {
files: 0,
bytes: 0,
dirs: 0
}