Files
webnet/packages/taildrive/README.md
T
codingetandClaude f659f230cd
CI / lint (pull_request) Successful in 3m39s
CI / format (pull_request) Successful in 3m24s
CI / install (pull_request) Successful in 9m4s
CI / typetest (pull_request) Successful in 3m5s
CI / typecheck (pull_request) Successful in 3m20s
CI / node-tests (pull_request) Successful in 3m31s
CI / browser-tests (pull_request) Successful in 5m16s
docs: add per-package READMEs and position Tailshare as the flagship app
Give every workspace a README describing what it does, its entry points,
and a short usage example, and link them from the root package table.

Frame Tailshare in the root README as the application the libraries exist
to be composed into, with the other apps as development and testing
surfaces. Its own README records what works today and what the open
issues intend for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 23:51:59 +00:00

2.3 KiB

@webnet/taildrive

Taildrive peer discovery, WebDAV client helpers, and a server-side bridge, built on @webnet/webdav.

Taildrive exposes a WebDAV endpoint (/v0/drive) over each Tailscale node's peerapi. On the client side, listDrivePeersWithShares lists an IpnClient's Taildrive peers (via IPN.listDrivePeers) and probes each one over WebDAV, filtering out peers that are unreachable or export no shares; createTaildriveClient returns a @webnet/webdav DAVClient for a given peer, dialing through the IPN's dial/dialTLS methods rather than a real network socket. On the server side, bridgeDriveHandler adapts a @webnet/http Handler into the RawDriveHandler shape IPN.serveDrive expects, translating between the wasm bridge's request/response objects and @webnet/http's Context.

Entry points

Entry point Description
@webnet/taildrive Re-exports both ./client and ./server.
@webnet/taildrive/client createTaildriveClient, listDrivePeersWithShares.
@webnet/taildrive/server bridgeDriveHandler.

Usage

import { listDrivePeersWithShares, createTaildriveClient } from "@webnet/taildrive/client"
import type { IpnClient } from "@webnet/tsconnect"

async function browsePeerShares(ipn: IpnClient) {
  const peers = await listDrivePeersWithShares(ipn)
  for (const peer of peers) {
    const client = createTaildriveClient(ipn, peer)
    const { entries } = await client.statAndReaddir("/")
    console.log(
      peer.name,
      entries.map((e) => e.path),
    )
  }
}
import { bridgeDriveHandler } from "@webnet/taildrive/server"
import type { IpnClient } from "@webnet/tsconnect"
import type { Handler } from "@webnet/http/server"

function serveTaildrive(ipn: IpnClient, davHandler: Handler) {
  ipn.serveDrive(bridgeDriveHandler(davHandler))
}

See also

  • @webnet/tsconnectIpnClient, IPN.dial/dialTLS/serveDrive/listDrivePeers used by this package.
  • @webnet/webdavDAVClient and the WebDAV server Handler this package bridges to Taildrive.
  • @webnet/http — the Context/Handler shape bridgeDriveHandler adapts.