2.0.0-alpha.3
Pre-release
Pre-release
Fourth prerelease of the v2 redesign. Published to npm under the next dist-tag (latest remains 1.1.2).
npm i node-telegram-bot-api@nextSince 2.0.0-alpha.2:
- Uploads stream (#1332). Multipart bodies are hand-rolled as a web
ReadableStreamand passed straight tofetch(duplex: "half"), so file bytes flow from their source without being buffered - a 100MB upload now retains ~1MB instead of 200-300MB. Verified live against api.telegram.org and a self-hosted Bot API server (200MB) on Node, Deno, and Bun. - Explicit upload retry semantics.
Blob/Uint8Arraydata re-streams on retry; a bareReadableStreamis one-shot (sent once, failures surface immediately); the newInputFileStreamFactory(() => ReadableStream | Promise<ReadableStream>) opens a fresh stream per attempt and stays retryable. fromPath()streams from disk via a stream factory (re-opens the file per attempt; flat memory on Node and Deno, whoseopenAsBlobcompat buffers eagerly) and fails fast on a missing path.- Bun proxy guard. Bun < 1.4.0 never writes a stream body through an HTTP(S) CONNECT proxy (reported by us as oven-sh/bun#33918, fixed upstream by oven-sh/bun#32635); affected proxied Bun transparently falls back to a buffered
Blobbody. Direct-connection Bun and Bun >= 1.4.0 stream like Node/Deno. - Multipart hardening. Part names/filenames use WHATWG escaping; a CR/LF in
meta.contentTypecan no longer inject part headers. - Default
timeoutMsraised to 5 minutes (was 30s) so large uploads are not cut off mid-stream;getUpdatesstill derives its own long-poll timeout. - Removed
inputFileToBlob- nothing converts toFormDataanymore. - The uploads example now shows the fetch-and-stream-through and stream-factory patterns.
Full compare: v2.0.0-alpha.2...v2.0.0-alpha.3