« home

Guide: Using Dat from the command-line

The dat command line tool can be used to share, download, and sync files across many computers via the command line.


Install via npm:

npm install -g dat

You can make sure the install worked by running the dat command. The usage guide should print.

See the installation troubleshooting for tips if the installation failed.

Sharing Files

      dat create
      Created empty Dat in /my-files-to-share/.dat

      Now you can add files and share:
      * Run dat share to create metadata and sync.
      * Copy the unique dat link and securly share it.


Now you should have a .dat folder inside my-files-to-shareand prompt you to create a dat.json file. Once the dat is created, you can start sharing it over the p2p network:

      dat sync
      Sharing dat: 17 files (54 MB)

      0 connections | Download 0 B/s Upload 0 B/s

      Creating metadata for 60 files (223 MB/s)
      [====================----------------------] 50%
      ADD: data-gov-metadata/children-meta.json.gz (1.2 GB / 2.1 GB)

      Ctrl+C to Exit

The sync command will also watch your directory for changes and share any updated files.

Downloading Files

Once the files are shared somewhere, you can clone them to another location:

      dat clone dat://56c1977328c94c988137c9ff3cbeaab217d765772299840e7be7172b18dbb151 download-folder
      Created new dat in /download-folder/.dat
      Cloning: 131 files (2.5 GB)

      1 connection | Download 70 MB/s Upload 0 B/s

      Downloading updates...
      [=====-------------------------------------] 13.81%

      Ctrl+C to Exit

Downloading Updates

After you clone a Dat archive, you can update the files later:

      dat pull
      Downloading dat: 138 files (2.8 GB)

      0 connections | Download 608 KB/s Upload 0 B/s

      Downloading updates...
      [==========--------------------------------] 24.05%

      Ctrl+C to Exit