KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
files
★ 10
Open GitHub ↗
Handle and download received media files.
Download README (.md)
Explore Similar Repositories
docker-babashka
:
No description available.
Calculator
:
No description available.
SpMV-on-Many-Core
:
A cross-platform Sparse Matrix Vector Multiplication (SpMV) framework for many-core architectures (GPUs and Xeon Phi).
drone_CF-mMIMO
:
No description available.
FoxClient
:
A Fabric (and Quilt) Mod that changes the look of the Minecraft UI and adds some features.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
files
?
Download (.md)
# File handling simplified in grammY This plugin allows you to easily download files from Telegram servers. Check out [the official plugin page](https://grammy.dev/plugins/files.html) for further documentation. ## Example ```ts import { Bot, type Context } from "grammy"; import { type FileFlavor, hydrateFiles } from "@grammyjs/files"; // Transformative API flavor type MyContext = FileFlavor<Context>; // Create bot const bot = new Bot<MyContext>(""); // Install plugin bot.api.config.use(hydrateFiles(bot.token)); // Download videos and GIFs to temporary files bot.on([":video", ":animation"], async (ctx) => { // Prepare file for download const file = await ctx.getFile(); // Download file to temporary location on your disk const path = await file.download(); // Print file path console.log("File saved at", path); }); ``` You can pass a string with a file path to `download` if you don't want to create a temporary file. Just do `await file.download('/path/to/file')`.