userfile
The userfile namespace — the engine's Luau API reference for userfile.
The userfile namespace — 2 functions.
globals/userfile/pick
globals/userfile/pick(opts: PickOpts?) -> PickResult
Open the user's system file picker and bring the chosen file(s)
into the engine. Yields until the user finishes (call from a coroutine /
task, like any task.await) and returns
{ cancelled, files = {{ name, mime, size, bytes?, vfsPath? }} }.
Without writeTo each file carries bytes (a binary-safe string);
with writeTo each carries vfsPath (read it with vfs.read).
Cancelling returns { cancelled = true, files = {} }; a genuine failure
(e.g. a lost browser user-activation gesture) raises an error.
globals/userfile/pickFolder
globals/userfile/pickFolder(opts: PickOpts?) -> PickResult
Convenience for userfile.pick({ folder = true }) — pick a whole
directory tree. Yields until the user finishes and returns the same
result table as pick. On the web this degrades to a multi-file selection.