@gramio/files
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -6,3 +6,3 @@ /** | ||
* | ||
* [Documentation](https://gramio.netlify.app/files/overview.html) | ||
* [Documentation](https://gramio.dev/files/overview.html) | ||
* | ||
@@ -9,0 +9,0 @@ * @example |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* [Documentation](https://gramio.netlify.app/files/overview.html) | ||
* [Documentation](https://gramio.dev/files/overview.html) | ||
* | ||
@@ -10,0 +10,0 @@ * @example |
@@ -5,3 +5,3 @@ import type { TelegramInputMediaAnimation, TelegramInputMediaAudio, TelegramInputMediaDocument, TelegramInputMediaPhoto, TelegramInputMediaVideo } from "@gramio/types"; | ||
* | ||
* [Documentation](https://gramio.netlify.app/files/media-input.html) | ||
* [Documentation](https://gramio.dev/files/media-input.html) | ||
*/ | ||
@@ -8,0 +8,0 @@ export declare class MediaInput { |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* [Documentation](https://gramio.netlify.app/files/media-input.html) | ||
* [Documentation](https://gramio.dev/files/media-input.html) | ||
*/ | ||
@@ -10,0 +10,0 @@ class MediaInput { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MEDIA_METHODS = exports.isFile = void 0; | ||
exports.MEDIA_METHODS = void 0; | ||
exports.isFile = isFile; | ||
/** Guard for check is it {@link File} or {@link Promise} */ | ||
@@ -10,3 +11,2 @@ function isFile(file) { | ||
} | ||
exports.isFile = isFile; | ||
/** | ||
@@ -41,2 +41,12 @@ * A set of methods with the function of checking whether a {@link File} has been passed in the parameters | ||
], | ||
sendPaidMedia: [ | ||
(params) => params.media.some((x) => "media" in x && isFile(x.media)), | ||
[ | ||
{ | ||
name: "media", | ||
property: "media", | ||
type: "array", | ||
}, | ||
], | ||
], | ||
sendMediaGroup: [ | ||
@@ -43,0 +53,0 @@ (params) => params.media.some((x) => "media" in x && isFile(x.media)) || |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { Readable } from "node:stream"; | ||
@@ -7,3 +5,3 @@ /** | ||
* | ||
* [Documentation](https://gramio.netlify.app/files/media-upload.html) | ||
* [Documentation](https://gramio.dev/files/media-upload.html) | ||
*/ | ||
@@ -10,0 +8,0 @@ export declare class MediaUpload { |
@@ -13,3 +13,3 @@ "use strict"; | ||
* | ||
* [Documentation](https://gramio.netlify.app/files/media-upload.html) | ||
* [Documentation](https://gramio.dev/files/media-upload.html) | ||
*/ | ||
@@ -16,0 +16,0 @@ class MediaUpload { |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { Readable } from "node:stream"; | ||
@@ -4,0 +2,0 @@ import type { APIMethodParams, APIMethods } from "@gramio/types"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertStreamToBuffer = exports.convertJsonToFormData = exports.isMediaUpload = void 0; | ||
exports.isMediaUpload = isMediaUpload; | ||
exports.convertJsonToFormData = convertJsonToFormData; | ||
exports.convertStreamToBuffer = convertStreamToBuffer; | ||
const node_crypto_1 = require("node:crypto"); | ||
@@ -14,3 +16,2 @@ const media_methods_helper_1 = require("./media-methods-helper"); | ||
} | ||
exports.isMediaUpload = isMediaUpload; | ||
function generateAttachId() { | ||
@@ -73,3 +74,2 @@ return (0, node_crypto_1.randomBytes)(12).toString("hex"); | ||
} | ||
exports.convertJsonToFormData = convertJsonToFormData; | ||
/** Helper for convert Readable stream to buffer */ | ||
@@ -83,2 +83,1 @@ function convertStreamToBuffer(stream) { | ||
} | ||
exports.convertStreamToBuffer = convertStreamToBuffer; |
{ | ||
"name": "@gramio/files", | ||
"main": "./dist/index.js", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"type": "commonjs", | ||
@@ -23,9 +23,9 @@ "description": "Set of utils for work with files and Telegram Bot API", | ||
"@biomejs/biome": "1.7.3", | ||
"@types/bun": "^1.1.1", | ||
"@types/node": "^20.12.11", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.4.5" | ||
"@types/bun": "^1.1.6", | ||
"@types/node": "^20.14.9", | ||
"prettier": "^3.3.2", | ||
"typescript": "^5.5.2" | ||
}, | ||
"dependencies": { | ||
"@gramio/types": "^7.3.4" | ||
"@gramio/types": "^7.6.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "files": [ |
# @gramio/files | ||
[`@gramio/files`](https://github.com/gramiojs/files) is set of utils for work with files and Telegram Bot API. You can also use it outside of [GramIO](https://gramio.netlify.app/) framework because it is framework-agnostic. | ||
[`@gramio/files`](https://github.com/gramiojs/files) is set of utils for work with files and Telegram Bot API. You can also use it outside of [GramIO](https://gramio.dev/) framework because it is framework-agnostic. | ||
@@ -9,4 +9,4 @@ [![npm](https://img.shields.io/npm/v/@gramio/files?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/@gramio/files) | ||
## Please see [Documentation](https://gramio.netlify.app/files/overview.html) and [API Reference](https://jsr.io/@gramio/files/doc) | ||
## Please see [Documentation](https://gramio.dev/files/overview.html) and [API Reference](https://jsr.io/@gramio/files/doc) | ||
Currently, support Telegram Bot API v7.3+ | ||
Currently, support Telegram Bot API v7.6+ |
472
18430
Updated@gramio/types@^7.6.0