Module

x/grammy/platform.node.ts

The Telegram Bot Framework.
Go to Latest
File
// === Needed importsimport { Agent as HttpAgent } from "http";import { Agent as HttpsAgent } from "https";import { Readable } from "stream";
// === Export debugimport { debug as d } from "debug";export { d as debug };
// === Export system-specific operations// Turn an AsyncIterable<Uint8Array> into a streamexport const itrToStream = (itr: AsyncIterable<Uint8Array>) => Readable.from(itr, { objectMode: false });
// === Base configuration for `fetch` callsexport function baseFetchConfig(apiRoot: string) { if (apiRoot.startsWith("https:")) { return { compress: true, agent: new HttpsAgent({ keepAlive: true }) }; } else if (apiRoot.startsWith("http:")) { return { agent: new HttpAgent({ keepAlive: true }) }; } else return {};}
// === InputFile handling and File augmenting// Accessor for file data in `InputFile` instancesexport const toRaw = Symbol("InputFile data");