• Stars
    star
    309
  • Rank 134,487 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

dcp | Dat Copy - remote file copy, powered by the Dat protocol

dcp - Dat Copy

Remote file copy, powered by the Dat protocol.

CircleCI branch npm npm NpmLicense

dcp copies files between hosts on a network using the peer-to-peer Dat network. dcp can be seen as an alternative to tools like scp, removing the need to configure SSH access between hosts. This lets you transfer files between two remote hosts, without you needing to worry about the specifics of how said hosts reach each other and regardless of whether hosts are behind NATs.

dcp requires zero configuration and is secure, fast, and peer-to-peer.

WARNING - this is not production-ready software. Use at your own risk

Contents

Example

dcp example

Use cases

  • Send files to multiple colleagues - just send the generated public key via chat and they can receive the files on their machine.
  • Sync files between two physical computers on your local network, without needing to set up SSH access.
  • Easily send files to a friend without needing to create a zip and upload it the cloud.
  • Copy files to a remote server when you have shell access but not SSH, for example on a kubernetes pod.
  • Share files between linux/macOS and Windows, which isn't exactly known for great SSH support.

How dcp works

dcp will create a dat archive for a specified set of files or directories and, using the generated public key, lets you download said archive from other hosts. Any data shared over the network is encrypted using the public key of the archive, meaning data access is limited to those who have access to said key. For more information on how Dat works, you can browse the docs or read their whitepaper.

Advantages over plain dat

dcp is designed to have an API that is more reminiscent of scp and rsync. The standard cli dat program requires the additional mental overhead of understanding how the underlying Dat protocol works. dat forces you to share a single whole folder, whilst with dcp you can copy an arbitrary set of paths. dat also pollutes the filesystem with metadata files, whereas with dcp these are kept in-memory instead.

Performance

You can expect dcp to transfer at a similar speed to both rsync and scp.

Here's a benchmark for moving a 396.12MB file from my personal computer to a remote server over my 50mpbs connection.

Method Time
rsync 1m07s
scp 1m07s
dcp 1m10s

Installation

npm i -g dat-cp

Installing without npm

Alternatively, packaged binaries are available on the releases page. These bundle all dependencies into a single standalone binary.

Simply extract the zip and move the dcp[.exe] binary to a folder in your path, e.g. /usr/local/bin.

Usage

Usage: dcp [options] {files ... | key}

Dat Copy - remote file copy, powered by the dat protocol.

Options:
  -V, --version    output the version number
  -r, --recursive  recursively copy directories
  -n, --dry-run    show what files would have been copied
  --skip-prompt    automatically download without a prompt
  -v, --verbose    verbose mode - prints extra debugging messages
  -h, --help       output usage information

Example:

    Send files from host A:

        > dcp foo.txt bar.txt

    Receive files on host B:

        > dcp <generated public key>

Sending files

Pass an arbitrary set of files or directories to dcp to be copied. Copy the generated public key and use it to receive the files on a different host.

> dcp [-r] [-n] [-v] files ...
  • Use -n/--dry-run to see what files will be sent
  • Use -r/--recursive to recursively copy files within directories
  • Use -v/--verbose to print extra debugging information

Receiving files

Invoke dcp with the generated public key to receive the copied files.

> dcp [-n] [-v] [--skip-prompt] <generated public key>
  • Use -n/--dry-run to see what files will be received
  • Use -v/--verbose to print extra debugging information
  • Use --skip-prompt to skip the download prompt

Development

Install dependencies:

npm i

Run the tests:

npm t

Test the CLI executable

npm run cli -- foo.txt -v

Note the -- preceding the arguments.

More Repositories

1

p2p.chat

p2p video conferencing powered by WebRTC.
TypeScript
615
star
2

Emote

Emoji Picker for Linux written in GTK3
Python
482
star
3

wikitrivia

Wikidata as a trivia card game.
TypeScript
436
star
4

old-reddit-redirect

Ensure Reddit always loads the old design
JavaScript
305
star
5

reddit-comment-collapser

A more elegant solution for collapsing reddit comment trees
JavaScript
42
star
6

phantomjs-polyfill

JavaScript
42
star
7

wtp-ext

Proof-of-concept distributed web powered by WebTorrents
CSS
41
star
8

breaktimer

Chrome/Firefox Extension for managing periodic breaks
HTML
38
star
9

wikitrivia-generator

Rust
32
star
10

detoxed.news

The important news, without the toxicity.
TypeScript
24
star
11

wallpaper-macos

Set wallpaper on macOS, natively using nodobjc
JavaScript
16
star
12

earthview-scraper

Python script for scraping all images from Google Earth View
Python
8
star
13

c-js-benchmarks

Comparing C Wasm and JS performance
JavaScript
4
star
14

learn-c

Exercises and notes for C refresher
C
3
star
15

macos-space-change

Setup a callback for macOS space change
JavaScript
3
star
16

tomjwatson.com

The code that powers https://www.tomjwatson.com
TypeScript
3
star
17

ulauncher-popdark

A uLauncher theme that fits in well with the Pop!_OS Dark theme.
CSS
2
star
18

toms-lighting-pi

Raspberry pi webserver for interfacing with Unicorn PHAT lighting. Controllable via https://github.com/tom-james-watson/toms-lighting-app
Python
2
star
19

git-publish-npm

Publish a Git repository to NPM
JavaScript
1
star
20

osx-automation

Apple Scripts for OS X automation
AppleScript
1
star
21

toms-lighting-app

React native app for controlling my raspberry pi powered lighting
JavaScript
1
star
22

dat-camcorder

Record & save video with the Beaker Browser
JavaScript
1
star
23

case-for-nuclear

Arguing the case for nuclear as a source of low-carbon energy for the 21st Century
TypeScript
1
star