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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tg-mtproto-cli

v0.1.1

Published

CLI for Telegram via MTProto — chats, messages, media download, multi-account

Readme

tg-mtproto-cli

CLI for Telegram via MTProto. Direct access to chats, messages and media — no Bot API, no limits.

Features

  • Multi-account — manage multiple Telegram accounts with aliases
  • Chats — list dialogs with unread counters
  • Messages — fetch messages from any chat, group or supergroup
  • Forum topics — list and read topics in supergroup forums
  • Media download — download photos, videos, documents
  • Time filter--after to show messages since a specific time
  • JSON output--json flag for scripting and piping
  • Secure storage — credentials in system keychain (macOS Keychain, Windows Credential Vault, Linux Secret Service)

Prerequisites

You need Telegram API credentials (api_id and api_hash). Get them at my.telegram.org.

Install

npm install -g tg-mtproto-cli

Quick start

# Authenticate (will prompt for API credentials on first run)
tg auth

# List your chats
tg chats

# Last 20 messages from a chat
tg messages @username -n 20

# Messages since 9am today
tg messages @username --after 09:00

# Download a photo
tg download @username 42

Commands

| Command | Description | |---|---| | tg auth | Authenticate a Telegram account | | tg logout <alias> | Log out and remove session | | tg accounts | List all accounts | | tg accounts rename <old> <new> | Rename an account alias | | tg default <alias> | Set the default account | | tg chats | List chats | | tg messages <chat> | List messages from a chat | | tg topics <chat> | List forum topics in a supergroup | | tg download <chat> <messageId> | Download media from a message |

Messages options

tg messages <chat> [options]

| Option | Description | |---|---| | -n <count> | Number of messages (default: 100) | | --all | Load entire chat history | | --topic <id> | Messages from a specific forum topic | | --after <datetime> | Messages after a given time |

--after accepts: 2026-02-22, 2026-02-22T10:00, 10:00 (today).

Global flags

| Flag | Description | |---|---| | --account <alias> | Use a specific account | | --json | Output in JSON format |

How it works

Uses mtcute for MTProto protocol. Sessions are stored in ~/.tg-mtproto-cli/sessions/. Credentials are stored in the system keychain via cross-keychain.

License

MIT