Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# @push.rocks/smartsamba
|
||||
|
||||
A TypeScript Samba/SMB client and server module backed by a bundled Rust SMB engine.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
pnpm add @push.rocks/smartsamba
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { SambaServer, SambaClient } from '@push.rocks/smartsamba';
|
||||
|
||||
const server = new SambaServer({
|
||||
port: 0,
|
||||
users: [{ username: 'alice', password: 'secret' }],
|
||||
shares: [{ name: 'files', path: './shared' }],
|
||||
});
|
||||
|
||||
const started = await server.start();
|
||||
|
||||
const client = new SambaClient({
|
||||
host: '127.0.0.1',
|
||||
port: started.port,
|
||||
auth: { username: 'alice', password: 'secret' },
|
||||
});
|
||||
|
||||
await client.writeFile('files', 'hello.txt', 'hello samba');
|
||||
const data = await client.readFileAsString('files', 'hello.txt');
|
||||
|
||||
await client.stop();
|
||||
await server.stop();
|
||||
```
|
||||
|
||||
The TypeScript API uses `@push.rocks/smartrust` to communicate with the bundled `rustsamba` binary built by `@git.zone/tsrust`. It does not wrap system `smbd` or `smbclient`.
|
||||
Reference in New Issue
Block a user