Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Dat is a decentralized data tool for distributing data small and large.
This guide will help you get started with the Dat command line tool. We are also developing web and desktop applications for Dat.
The Dat command line tool can be used to share, download, and sync files across many computers via the command line.
Windows | Mac/Linux | Version |
---|---|---|
npm install -g dat
You should be able to run the dat
command now. If not, see the installation troubleshooting for tips.
We have Dat installed, now let's use it! In this quick demo we will download our documentation files using Dat.
You tell Dat what files to download by giving it a Dat link. Dat links are 64 character strings, for example 395e3467bb5b2fa083ee8a4a17a706c5574b740b5e1be6efd65754d4ab7328c2
.
Along with the link, you tell Dat where to download the files. All together, you can download files by typing dat <dat-link> <download-directory>
.
We have our Dat documentation folders being shared by Dat (at the key above). For this example, we can download those files to your computer. In your console, run:
dat 395e3467bb5b2fa083ee8a4a17a706c5574b740b5e1be6efd65754d4ab7328c2 dat_docs
You should see the output below. Once the download is finished, the files will be available on your computer in the dat_docs
folder!
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.
There are two commands in Dat:
dat <directory>
will share a directory on your computer.dat <dat-link> <download-directory>
will download files from the Dat link to a directory on your computer.Running dat
in the console, with no arguments, will show you the usage guide. You can always use this as a reference for all the commands:
dat <directory>
share directory and create a dat-link
--snapshot create a snapshot of directory
--port, -p set a specific inbound tcp port
dat <dat-link> <directory>
download a dat-link into directory
--exit exit process after download finishes
--port, -p set a specific inbound tcp port
general options
--version, -v get installed dat version
--temp use in-memory database instead of .dat folder
--webrtc connect to webrtc peers via electron-webrtc
--doctor run dat doctor
--quiet, -q output only dat-link, no progress information
--debug show debugging output
--ignore-hidden ignore hidden files (true by default)
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 and the process is still running. The hash is a secret hash, your data is visible to anyone you send the hash to.
Dat makes it easy to share a folder and send files as they are added to the folder. By default, when you share using dat my_data/
you will be in live sync mode. Anyone connected to you will receive new files.
A snapshot reads the files and creates a unique link that will always be the same for that set of files (if they remain unchanged). To create a snapshot use the snapshot option: dat my_data/ --snapshot
. Snapshots are automatically created for you in live mode as files update.
dat <directory> --snapshot
Share a snapshot of the current files.
dat <directory> --port=1234
Set your inbound TCP port. This is useful for debugging or on restrictive networks.
Download files from a Dat link by typing: dat <dat-link> <download-directory>
:
$ 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...
Dat will start downloading the data into the download_dir
folder. Once the download is finished (a message will print and the bar will turn green), you can safely exit the process with Ctrl-C
(Cmd-C
on Mac).
While downloading, you may be connected to more than 1 peer. Anyone who has the Dat link will be able to download and re-host a copy of the data. So you may be downloading from (and sharing to) other people that are also downloading that data! You only need one block of data to start helping as a host. It's distributed mad science!
What happens if the files get updated? Dat auto-syncs new files if it is still running. If you exited the process, you can run the same command you ran before (with the same link and directory) and the files will update!
dat <dat-link> <directory> --exit
After files are done downloading, exit the process. If you are connected to a live Dat you will not get new files unless you run the command again.
dat <dat-link> <directory> --port=1234
Set your inbound TCP port. This is useful for debugging or on restrictive networks.
Dat makes it easy to share a folder and send files as they are changed or added. By default, when you share using Dat you will be in live sync mode. Anyone connected to you will receive file changes as you make them.
When downloading a Dat, you do not have to worry about live mode. It will automatically start in the right mode based on the link.
To create a snapshot when sharing files use the snapshot option: dat my_data/ --snapshot
. A snapshot reads the files and creates a specific link that will never change (as long as the files don't change).
When you run a command, Dat creates a hidden folder, .dat
, in the directory specified. Similar to git, this folder stores information about your Dat. File metadata and the Dat link are stored to make it easy to continue sharing or downloading the same directory.
Use the --temp
option to keep the metadata in memory instead of the .dat
folder.
You can use the --webrtc
option to share files to dat.land. You'll need to install electron-webrtc
in order for this to work.
We've provided some troubleshooting tips based on issues users have seen. Please open an issue or ask us in our chat room if you need help troubleshooting and it is not covered here.
If you have trouble sharing/downloading in a directory with a .dat
folder, try deleting it and running the command again.
Knowing the version is really helpful if you run into any bugs, and will help us troubleshoot your issue.
Check your Dat version:
dat -v
You should see the Dat semantic version printed, e.g. 11.1.2.
To use the Dat command line tool you will need to have node and npm installed. Make sure those are installed correctly before installing Dat. You can check the version of each:
node -v
npm -v
The -g
option installs Dat globally allowing you to run it as a command. Make sure you installed with that option.
EACCES
error, read this guide on fixing npm permissions.EACCES
error, you may also install dat with sudo: sudo npm install -g dat
.Networking capabilities vary widely with each computer, network, and configuration. Whenever you run a Dat there are several steps to share or download files with peers:
With successful use, Dat will show Connected to 1 peer
after connection. If you never see a peer connected your network may be restricting discovery or connection. Please try using the dat --doctor
command (see below) between the two computers not connecting. This will help troubleshoot the networks.
We've included a tool to identify network issues with Dat, the Dat doctor. You will need to run the command on both the computers you are trying to share data between. On the first computer, run:
dat --doctor
The doctor will print out a command to run on the other computer, dat --doctor=<64-character-string>
. The doctor will run through the key steps in the process of sharing data between computers to help identify the issue.
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 js library to a separate module, joehand/dat-js.
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 errorSwarm events and stats are available from dat.swarm
.
dat.on('connecting')
: looking for peersdat.on('swarm-update')
: peer number changeddat.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 changeddat.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 finisheddat.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
}
BSD-3-Clause
11.5.1 - 2016-10-24
FAQs
Dat is the package manager for data. Easily share and version control data.
The npm package dat receives a total of 156 weekly downloads. As such, dat popularity was classified as not popular.
We found that dat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.