npm node-telegram-bot-api 2.0.0-alpha.3

3 hours ago

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@next

Since 2.0.0-alpha.2:

  • Uploads stream (#1332). Multipart bodies are hand-rolled as a web ReadableStream and passed straight to fetch (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/Uint8Array data re-streams on retry; a bare ReadableStream is one-shot (sent once, failures surface immediately); the new InputFileStreamFactory (() => 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, whose openAsBlob compat 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 Blob body. 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.contentType can no longer inject part headers.
  • Default timeoutMs raised to 5 minutes (was 30s) so large uploads are not cut off mid-stream; getUpdates still derives its own long-poll timeout.
  • Removed inputFileToBlob - nothing converts to FormData anymore.
  • 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

Don't miss a new node-telegram-bot-api release

NewReleases is sending notifications on new releases.