mtcute/packages/node/README.md

27 lines
664 B
Markdown
Raw Normal View History

# @mtcute/node
2023-11-01 14:05:45 +03:00
📖 [API Reference](https://ref.mtcute.dev/modules/_mtcute_node.html)
2024-03-06 21:20:44 +03:00
Node.js support package for mtcute. Includes:
- Support for native crypto addon (must be installed separately, `@mtcute/crypto-node`)
- Terminal I/O via `readline`
2024-03-23 23:52:11 +03:00
- SQLite storage (via `better-sqlite3`)
- TCP transport (via `node:net`)
2024-03-06 21:20:44 +03:00
- `TelegramClient` implementation using the above
- HTML and Markdown parsers
## Usage
```typescript
2024-03-06 21:20:44 +03:00
import { TelegramClient } from '@mtcute/node'
2024-03-06 21:20:44 +03:00
const tg = new TelegramClient({
apiId: 12345,
apiHash: 'abcdef',
2023-11-01 14:05:45 +03:00
storage: 'my-account'
})
2024-07-26 06:46:18 +03:00
const self = await tg.start()
console.log(`✨ logged in as ${self.displayName}`)
```