Class
File
NotCreatableNotReplicated
An asset loaded from a file on disk.
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
File is destroyed or when the Studio session ends. Temporary asset IDs
are not shared across collaborative
sessions.
The default Name of a File instance will be the
filename on disk, excluding the path but including the extension.
Properties 1#
Sizeint64 | The size of the file on disk, in bytes.Read: PluginSecurityWrite: PluginSecurityReadSafeHiddenReadOnlyNotReplicated |
Methods 2#
| GetBinaryContents | Reads the contents of the File as a string.PluginSecurity security |
| GetTemporaryId | Gets a rbxtemp:// asset ID for this File.PluginSecurity security |
GetBinaryContents(): string#
PluginSecurity security
This function is used to read the contents of the File as a raw
binary string. This allows the file to be uploaded to web endpoints, or to
be processed by plugins.
Returns
string— A raw binary string representation of theFilecontents.
GetTemporaryId(): ContentId#
PluginSecurity security
This function is used to retrieve a temporary asset ID associated with the
File. The ID can be used like rbxassetid://, for example it can
be assigned to the Image property of an
ImageLabel.
Throws an error if the file does not exist on disk.
Returns
ContentId— The temporary asset ID.
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild