npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@airgrams/web

v6.0.2

Published

Use [`tdweb`](https://github.com/tdlib/td/tree/master/example/web/tdweb) on steroids.

Downloads

8

Readme

Airgram for tdweb

Use tdweb on steroids.

Features

  • Strictly typed;
  • Documentation out of the box;
  • Supports models;
  • Built on middleware;

All TDLib classes and methods are described and have suitable wrappers in Airgram. There are only two differences:

  • All parameter names are represent in "camelCase".
  • Parameter @type renamed to _.

Documentation


Check out airgram documentation:


TDLib API reference:

Installation

npm install tdweb-airgram

Usage

Configuration

This section describes the options you can pass to Airgram constructor:

import { Airgram } from 'tdweb-airgram'

const airgram = new Airgram({
  // options
})

TDLib options

| Key | Type | Note | | ------------------ | ------------------------ | ----------------------------------------------------------- | | useTestDc | boolean | If set to true, the Telegram test environment will be used instead of the production environment | | databaseDirectory | string | The path to the directory for the persistent database | | filesDirectory | string | The path to the directory for storing files | | useFileDatabase | boolean | If set to true, information about downloaded and uploaded files will be saved between application restarts | | useChatInfoDatabase | boolean | If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies useFileDatabase | | useMessageDatabase | boolean | If set to true, the library will maintain a cache of chats and messages. Implies useChatInfoDatabase | | useSecretChats | boolean | If set to true, support for secret chats will be enabled | | apiId | number | Application identifier for Telegram API access, which can be obtained at https://my.telegram.org | | apiHash | string | Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org | | systemLanguageCode | string | IETF language tag of the user's operating system language | | deviceModel | string | Model of the device the application is being run on | | systemVersion | string | Version of the operating system the application is being run on | | applicationVersion | string | Application version | | enableStorageOptimizer | boolean | If set to true, old files will automatically be deleted | | ignoreFileNames | boolean | If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name | | databaseEncryptionKey | string | Encryption key |

tdweb options:

| Key | Type | Note | | ------------------ | ------------------------ | ----------------------------------------------------------- | | instanceName | string | Name of the TDLib instance. Currently only one instance of TdClient with a given name is allowed. All but one instances with the same name will be automatically closed. Usually, the newest non-background instance is kept alive. Files will be stored in an IndexedDb table with the same name. | | isBackground | boolean | Pass true, if the instance is opened from the background. Default: false | | jsLogVerbosityLevel | string | The initial verbosity level of the JavaScript part of the code (one of 'error', 'warning', 'info', 'log', 'debug'). Default: info | | logVerbosityLevel | number | The initial verbosity level for the TDLib internal logging (0-1023). Default: 2 | | useDatabase | boolean | Pass false to use TDLib without database and secret chats. It will significantly improve loading time, but some functionality will be unavailable. Default: true | | readOnly | boolean | For debug only. Pass true to open TDLib database in read-only mode. Default: false | | mode | string | For debug only. The type of the TDLib build to use. 'asmjs' for asm.js and 'wasm' for WebAssembly. If mode == 'auto' WebAbassembly will be used if supported by browser, asm.js otherwise. Default: auto |

Other options

| Key | Type | Note | | ------------------ | ------------------------ | ----------------------------------------------------------- | | models | Function | Contains function, which converts plain JSON objects to models. Details. | | contextFactory | Function | Function that returns custom middleware context. Details. |

API reference

This section describes public API of an Airgram instance:

| Key | Type | Note | | ------------------ | ------------------------ | ----------------------------------------------------------- | | api | Object | Contains wrappers for all TDLib methods. | | config | Object | Airgram configuration. Readonly. | | catch | (handler) => void | Overrides default error handler. Argument handler takes a function: (error: Error, ctx?: Record<string, any>) => void |

License

The source code is licensed under GPL v3. License is available here.