mirror of
https://github.com/TheodoreKrypton/tgfs
synced 2024-11-22 23:32:45 +00:00
.github/workflows | ||
src | ||
test | ||
.env.example | ||
.gitignore | ||
.prettierignore | ||
.prettierrc | ||
jest.config.js | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.build.json | ||
tsconfig.json | ||
yarn.lock |
tgfs
Use telegram as file storage
Tested on Windows, Ubuntu, MacOS
Installation
$ yarn install && yarn build
$ alias tgfs="yarn cmd"
Step by Step Guide to Set up Environment Variables
Create a Telegram app
- Go to Here, login with your phone number and create a Telegram app.
Set up api_id
and api_hash
- Duplicate the .env.example file and name it .env.local
- Copy the
api_id
andapi_hash
from the Telegram app page to the .env.local file (TELEGRAM_API_ID
andTELEGRAM_API_HASH
respectively)
Set up the channel to store files
- Create a new Telegram private channel (New Channel in the menu on the left)
- There should be a message like "Channel created". Right click the message and copy the post link.
- The format of the link should be like
https://t.me/c/1234567/1
, where1234567
is the channel id. Copy the channel id to the .env.local file (TELEGRAM_PRIVATE_FILE_CHANNEL
)
Create a Telegram bot
- Go to BotFather, create a new bot and copy the token to the .env.local file (
TELEGRAM_BOT_TOKEN
) - Add the bot to the channel as an administrator
Choose where to store the session file
- You can do this by editing the
TELEGRAM_SESSION_FILE
variable in the .env.local file. The default value is~/.tgfs/account.session
usage
-
ls
$ tgfs ls /
-
mkdir
$ tgfs mkdir /documents
-
cp
$ tgfs cp ~/some-file /
-
rm
$ tgfs rm /some-file