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

tgfs

v1.0.19

Published

Use telegram as file storage

Downloads

170

Readme

tgfs

Use telegram as file storage, with a command line tool and WebDAV server. Refer to the wiki page for more detail.

Test codecov npm version

Tested on Windows, Ubuntu, MacOS

Installation

Through NPM

$ npm install tgfs

Through Git

$ yarn install && yarn build
$ alias tgfs="yarn start:prod"

Use it as a WebDAV server

$ tgfs -w

or

$ tgfs --webdav

Tested WebDAV Clients:

cmd usage

  • ls

    $ tgfs cmd ls /
  • mkdir

    $ tgfs cmd mkdir /documents
    $ tgfs cmd mkdir -p /documents/pictures
  • cp

    $ tgfs cmd cp ~/some-file /
  • rm

    $ tgfs cmd rm /some-file
    $ tgfs cmd rm -r /some-folder

Step by Step Guide to Set up config

For feature development purpose, any configuration is unstable at the current stage. You may need to reconfigure following any update.

Automatically:

A config file will be auto-generated when you run the program for the first time. Just follow the instructions to create a Telegram app and a private channel to store the files.

Manually:

Preparation

  1. Duplicate the example-config.yaml file and name it config.yaml

Set up account details (why do I need this?)

  1. Go to Here, login with your phone number and create a Telegram app.
  2. Copy the api_id and api_hash from the Telegram app page (step 2) to the config file (telegram -> account -> api_id / api_hash)

Set up the channel to store files

  1. Create a new Telegram private channel (New Channel in the menu on the left)
  2. There should be a message like "Channel created". Right click the message and copy the post link.
  3. The format of the link should be like https://t.me/c/1234567/1, where 1234567 is the channel id. Copy the channel id to the config file (telegram -> private_file_channel)

Set up a Telegram bot (why do I need this?)

  1. Go to BotFather, send /newbot, and follow the steps to create a bot.
  2. Paste the bot token given by BotFater to the config file (telegram -> bot -> token)
  3. Go to your file channel (created in the previous step), add your bot to subscriber, and promote it to admin, with permission to send/edit/delete messages.

Config fields explanation

  • telegram

    • account/bot:
      • session_file: The file path to store the session data. If you want to use multiple accounts, you can set different session files for each account.
    • login_timeout: Time to wait before login attempt aborts (in milliseconds).
  • tgfs

    • users: the users authenticated by tgfs, used by both webdav authentication and monitor
    • download
      • chunk_size_kb: The chunk size in KB when downloading files. Bigger chunk size means less requests.
  • webdav

    • host: The host of the WebDAV server listening on.
    • port: The port of the WebDAV server listening on.
    • path: The root path for the WebDAV server. For example, setting this value to /webdav makes the WebDAV link http://[host]:[port]/webdav.

FAQ

Q: Why do I need a bot when my account is also able to send messages?

Frequently sending messages may get your account banned, so using a bot is the best way to manage the risk. You can create another bot when it is banned.

Q: Why do I need an account API then?

The functionality of bot API is limited. For example, a bot can neither read history messages, nor send files exceeding 50MB. The account API is used when a bot cannot do the job.