1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-12-15 00:26:57 +01:00
MadelineProto/docs/TD_docs/constructors/file.md

48 lines
1.2 KiB
Markdown
Raw Normal View History

---
title: file
description: Represents a file
---
## Constructor: file
[Back to constructors index](index.md)
Represents a file
### Attributes:
| Name | Type | Required | Description |
|----------|:-------------:|:--------:|------------:|
|id|[int](../types/int.md) | Yes|Unique file identifier, 0 for empty file|
|persistent\_id|[string](../types/string.md) | Yes|Persistent file identifier, if exists. Can be used across application restarts or even other devices for current logged user. If begins with "http: " or "https: ", it is HTTP URL of the file. Currently, TDLib is unable to download files if only they URL is known|
|size|[int](../types/int.md) | Yes|File size, 0 if unknown|
|path|[string](../types/string.md) | Yes|Local path to the file, if available|
### Type: [File](../types/File.md)
### Example:
```
2017-07-23 16:33:46 +02:00
$file = ['_' => 'file', 'id' => int, 'persistent_id' => 'string', 'size' => int, 'path' => 'string'];
```
2017-07-23 16:11:02 +02:00
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
2017-07-23 16:33:46 +02:00
{"_": "file", "id": int, "persistent_id": "string", "size": int, "path": "string"}
2017-07-23 16:11:02 +02:00
```
Or, if you're into Lua:
```
2017-07-23 16:33:46 +02:00
file={_='file', id=int, persistent_id='string', size=int, path='string'}
```