Disclaimer: p2pdrive is a working PoC and partially “vibe‑coded” (most of webDAV, console logs and this readme). Code is reviewed and tested (Mac).
Decentralized (p2p) drives to share files.
The owner of a drive can add, remove, edit files.
Peers may read/download. If you just want to download and support sharing, follow the Peers instructions below.
Provides a simple CLI that shares a Hyperdrive key over the Hyperswarm DHT and bridges it to a local WebDAV endpoint so you can browse it in Finder (macOS), Windows Explorer, or any WebDAV client.
- No daemon; single command per role.
- Owner (writer) and peers (read-only) both use the same CLI:
servedoes replication + WebDAV. - Minimal built-in WebDAV handler (no external WebDAV server dependency).
# Clone the repo
git clone [email protected]:Trac-Systems/p2pdrive.git
cd p2pdrive
# Install dependencies
npm install
# Link the CLI globally (so you can run `p2pdrive` from anywhere)
npm linkMake sure curl is available. Windows users download curl from here: https://curl.se/windows/
# 1) Create drive (writes secrets into ./store/drive-local/)
# reveals/generates the (public) key to be used for serve below
p2pdrive init -s ./store
# 2) Share + WebDAV on port 4918 (this both "seeds" and "serves")
# use the key from init above and replace it with <keyHex>
p2pdrive serve <keyHex> -s ./store --host 0.0.0.0 --port 4918
# expected banner should imply: (writable: true)Mounting see below (Mounting WebDAV).
Add file in mounted "dav" folder or upload a test file (owner side):
# Using the CLI (does not require the WebDAV server to be running)
p2pdrive put <keyHex> ./hello.txt /hello.txt -s ./store# Different storage dir than the owner to avoid Corestore lock
# use the key from init above and replace it with <keyHex>
p2pdrive serve <keyHex> -s ./mirror --host 127.0.0.1 --port 4919 --read-onlyMounting see below (Mounting WebDAV).
Tip: add
--verbosefor request logs and swarm details.
p2pdrive init [-s DIR]
p2pdrive seed [-s DIR] [--verbose]
p2pdrive serve <keyHex> [-s DIR] [-H HOST] [-p PORT] [--read-only] [--verbose]
p2pdrive put <keyHex> <src> <dst> [-s DIR]
p2pdrive get <keyHex> <src> <dst> [-s DIR]
p2pdrive ls <keyHex> [dir] [-s DIR]
- All commands use the same subfolder:
DIR/drive-local. - Single process per store: Don’t run
seedandserveat the same time against the same-s DIR(Corestore lock). servealready joins the DHT (so you generally don’t need to runseed).
Ports may vary by your choice or setup as of above. E.g. 4918 or 4919.
- Open Finder → Go → Connect to Server
- Enter:
http://127.0.0.1:4918/dav/ - Authenticate if prompted (this POC usually accepts anonymous)
- Your drive appears as a network folder.
- Open File Explorer
- Right-click This PC → Map Network Drive…
- Choose a drive letter
- In folder, enter:
http://127.0.0.1:4918/dav/ - If asked for credentials, leave blank or use anything (POC doesn’t check)
⚠️ Windows native client can be unreliable. If it fails, use Cyberduck or RaiDrive.
- Download Cyberduck, choose Open Connection → WebDAV (HTTP)
- Enter:
http://127.0.0.1:4918/dav/
- Download RaiDrive, Add → WebDAV
- Enter
http://127.0.0.1:4918/dav/and assign a drive letter.
- Open Files app
- Press
Ctrl+L, type:dav://127.0.0.1:4918/dav/ - Press Enter
- Open Dolphin
- In location bar, type:
webdav://127.0.0.1:4918/dav/ - Press Enter
sudo apt install davfs2
sudo mkdir /mnt/p2pdrive
sudo mount -t davfs http://127.0.0.1:4918/dav/ /mnt/p2pdriveTalk directly to the WebDAV endpoint (owner: 4918, peer: 4919). Make sure you include /dav/ in the path.
-
List root folder:
curl -v -X PROPFIND http://127.0.0.1:4918/dav/ -H "Depth: 1" -
Download a file:
curl -O http://127.0.0.1:4918/dav/hello.txt
-
Upload a file (owner only, writable):
curl -H 'Expect:' -T ./hello.txt http://127.0.0.1:4918/dav/hello.txt -
Delete a file (owner only, writable):
curl -X DELETE http://127.0.0.1:4918/dav/hello.txt
-
Rename/move a file:
curl -X MOVE http://127.0.0.1:4918/dav/hello.txt -H "Destination: http://127.0.0.1:4918/dav/hello-renamed.txt"
If you see 403 Forbidden, you’re using a read-only drive.
If you see 404 Not Found, verify the path and that you’re hitting /dav/.
- Owner: created the drive with
init. Has writer key → can PUT/DELETE/MOVE. - Peer: joined via public key only. Read-only, cannot modify.
-
ELOCKED: Two processes opened the same store dir. Stop one, or use different
-sdirs. If a process crashed, remove lock after ensuring nothing runs:rm -f ./store/drive-local/primary-key.lock
-
Finder “problem connecting”: Ensure the URL ends with
/dav/. Try--verboseto confirm requests. -
curl -Thangs: Add-H 'Expect:'to disable 100-continue wait. -
Can’t upload from peer: Only owner (writer) can upload.
-
Nothing shows up on peer: Ensure both
serveprocesses use the same key and owner is running.
Apache-2.0 — see LICENSE for details.