Use telegram as file storage, with a command line tool and WebDAV server. Refer to the wiki page for more detail.
Tested on Windows, Ubuntu, MacOS
$ npm install tgfs
$ yarn install && yarn build
$ alias tgfs="yarn start:prod"
$ tgfs -w
or
$ tgfs --webdav
Tested WebDAV Clients:
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
For feature development purpose, any configuration is unstable at the current stage. You may need to reconfigure following any update.
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.
example-config.yaml
file and name it config.yaml
api_id
and api_hash
from the Telegram app page (step 2) to the config file (telegram -> account -> api_id / api_hash
)https://t.me/c/1234567/1
, where 1234567
is the channel id. Copy the channel id to the config file (telegram -> private_file_channel
)/newbot
, and follow the steps to create a bot.telegram -> bot -> token
)telegram
tgfs
webdav
http://[host]:[port]/webdav
.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.