mtcute/packages/file-id
Alina Tumanova f5976a2d74
ESM + end-to-end tests (#11)
* feat: moved tl-runtime to esm and native ArrayBuffers

* feat: migration to esm

* fix(core): web-related fixes

* test: finally, some good fucking e2e

* chore: fixed linters etc

* ci: added e2e to ci

* build(tl): fixed gen-code on node 20

* fix: codegen Uint8Array, not Buffer

never `git reset --hard` kids

* build: only do type-aware linting for `packages/*`

* build: ignore no-unresolved in ci for e2e

* fix: node 16 doesn't have subtle crypto apparently?

* fix(tests): use Uint8Array

for gods sake please can i just merge this already

* ci: don't parallel tasks in ci

because machines are utter garbage and it may just randomly break

* ci: pass secrets to e2e tests

* ci: separate cli command for ci

apparently im retarded

* fix: run codegen in e2e

im actually retarded

* ci: more fixes for e2e

* ci: debugging stuff

* ci: still debugging

* ci: hopefully fix ci???
2023-10-16 19:23:53 +03:00
..
src ESM + end-to-end tests (#11) 2023-10-16 19:23:53 +03:00
tests ESM + end-to-end tests (#11) 2023-10-16 19:23:53 +03:00
package.json ESM + end-to-end tests (#11) 2023-10-16 19:23:53 +03:00
README.md refactor: changed stylizing of the name (MTCute -> mtcute) 2022-09-14 16:18:56 +03:00
tsconfig.json ESM + end-to-end tests (#11) 2023-10-16 19:23:53 +03:00
typedoc.js chore: code quality improvements 2023-06-05 00:30:48 +00:00

@mtcute/file-id

A package that is used internally by @mtcute/client to parse, serialize and manipulate TDLib and Bot API compatible File IDs, but can also be used for any other purposes.

Contents

This package exports a number of functions, namely:

  • parseFileId() which parses provided File ID to an object representing its contents
  • toFileId() which serializes provided object containing file info to a File ID
  • toUniqueFileId() which serializes provided object containing file info to a Unique File ID
  • fileIdTo*() which converts a File ID to an input TL object, which can be used in RPC calls etc.

This package also exports namespace tdFileId, which contains all the types used by the library

Acknowledgements

This is basically a port of a portion of TDLib APIs, but greatly simplified in usage and made to work seamlessly with the rest of the mtcute APIs.

This is a list of files from TDLib repository, from which most of the code was taken:

Additionally, some of the test cases were taken from a similar Python library, luckydonald/telegram_file_id