mtcute/packages/file-id
teidesu ec736f8590 some changes
i've been wanting to name a commit like this for my entire life, lol. seriously though, a lot has changed:
 - extracted TL-related stuff to `@mtcute/tl-utils` and `@mtcute/tl-runtime`, rewrote codegen in TS
 - updated to layer 134, moved to int64 identifiers
 - rewritten networking (mtproto), rewritten updates handling
 - *lots* of refactoring

 still a very early version though, there are a lot of improvements to be made, but at least it runs, lol

 also tl-reference will not be updated anytime soon because i want to rewrite it
2021-11-23 00:03:59 +03:00
..
src some changes 2021-11-23 00:03:59 +03:00
tests build: fixed scripts, eslintignore, fixed linter warnings and re-formatted with prettier 2021-06-06 15:20:41 +03:00
package.json some changes 2021-11-23 00:03:59 +03:00
README.md rename back to mtcute 2021-08-05 20:38:24 +03:00
tsconfig.json rename back to mtcute 2021-08-05 20:38:24 +03: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

Dependencies

This package uses @mtcute/core BinaryReader and BinaryWriter classes to work with binary streams. Additionally, it depends on @mtcute/tl types to allow type-safe code for conversion functions.

Note that @mtcute/core itself depends on @mtcute/tl, which might redundantly increase your bundle size in case you don't actually use TL types.

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