Yuari
Documentation
Docs/File system/writecustomasset

writecustomasset(path, data)

Writes a file into the workspace and returns an rbxasset:// id for it.

Syntax

writecustomasset(path: string, data: string) -> string

Parameters

ParameterTypeDescription
pathstringWorkspace-relative file path.
datastringFile contents (for example PNG bytes).

Returns

TypeDescription
stringrbxasset:// id that ContentProvider can load.

Description

Writes the file with the same rules as writefile, copies it into the ExtraContent folder and returns the rbxasset:// URL. The site is the asset id equivalent of getcustomasset for data that is not on disk yet.

The write is synchronous; use writefileasync first if you need to avoid blocking the current frame.

Example

local id = writecustomasset("icon.png", imageBytes)
print(id:find("^rbxasset://") ~= nil)