rojo/.cursor/rules/roblox/reference/engine/classes/File.yaml
2026-02-02 12:08:47 -06:00

95 lines
2.8 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: File
type: class
memory_category: Instances
summary: |
An asset loaded from a file on disk.
description: |
An object that represents an asset loaded from a file on a local disk. Files
generate a temporary asset ID in the form `rbxtemp://` which can be used in
Studio without uploading the asset, but will be destroyed when the
`Class.File` is destroyed or when the Studio session ends. Temporary asset IDs
are not shared across [collaborative](../../../projects/collaboration.md)
sessions.
The default `Class.Instance.Name|Name` of a `Class.File` instance will be the
filename on disk, excluding the path but including the extension.
code_samples: []
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- NotReplicated
deprecation_message: ''
properties:
- name: File.Size
summary: |
The size of the file on disk, in bytes.
description: |
The file size (in bytes) of the local file associated with this
`Class.File`.
code_samples: []
type: int64
tags:
- Hidden
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: PluginSecurity
write: PluginSecurity
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- AssetRead
methods:
- name: File:GetBinaryContents
summary: |
Reads the contents of the `Class.File` as a string.
description: |
This function is used to read the contents of the `Class.File` as a raw
binary string. This allows the file to be uploaded to web endpoints, or to
be processed by plugins.
code_samples: []
parameters: []
returns:
- type: string
summary: |
A raw binary string representation of the `Class.File` contents.
tags: []
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities:
- AssetRead
- name: File:GetTemporaryId
summary: |
Gets a `rbxtemp://` asset ID for this `Class.File`.
description: |
This function is used to retrieve a temporary asset ID associated with the
`Class.File`. The ID can be used like `rbxassetid://`, for example it can
be assigned to the `Class.ImageLabel.Image|Image` property of an
`Class.ImageLabel`.
Throws an error if the file does not exist on disk.
code_samples: []
parameters: []
returns:
- type: ContentId
summary: |
The temporary asset ID.
tags: []
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities:
- AssetRead
events: []
callbacks: []