Files
webnet/packages/smb2/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

1.7 KiB

@webnet/smb2

SMB2/3 client built on @webnet/transport and @webnet/vfs. There is no server.

SMB2Client implements AsyncVFS (stat, readdir, statAndReaddir, readFile/readFileRange, writeFile, mkdir, delete, move, copy, setProps) over a single share. It dials through a RawDialer, negotiates the highest of SMB 2.0.2, 2.1.0, or 3.1.1 that the server supports, and authenticates with NTLM wrapped in SPNEGO via Credentials (username/password/optional domain/spn). SMB2Client also implements StateTransferable<SMB2TransferState> from @webnet/state-transfer, so an established connection's state (dialect, session, tree, signing key) can be serialized and later resumed with SMB2Client.adopt — the transferred state carries no credentials, so SMB2AdoptOptions supplies them again for reconnect fallback. Errors surface as Smb2Error.

_internals entry points are unstable and are not part of the public API.

Usage

import { SMB2Client } from "@webnet/smb2"
import type { RawDialer } from "@webnet/transport"

declare const dialer: RawDialer

const client = new SMB2Client({
  dialer,
  host: "example.com",
  share: "shared",
  username: "u",
  password: "p",
})
await client.connect()
const entries = await client.readdir("/")
const stream = await client.readFile("/file.txt")
await client.disconnect()

See also