# @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` 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 ```ts 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 - [`@webnet/vfs`](../vfs) — the `AsyncVFS` interface this package implements - [`@webnet/transport`](../transport) — the `RawDialer` primitive this package dials through - [`@webnet/state-transfer`](../state-transfer) — the `StateTransferable` interface this package implements for connection handoff