Sandbox
sandbox.fs
Returns
Microsandbox::Filesystem
Guest filesystem operations.
Filesystem
These helpers also have direct sandbox equivalents:sandbox.fs_read, fs_write, fs_mkdir, fs_list, fs_stat, fs_exists?, fs_copy, fs_rename, fs_remove, fs_remove_dir, fs_copy_from_host, and fs_copy_to_host, with the same arguments and return values.
fs.read()
Example
Example
Parameters
pathStringGuest path.
Returns
String
File contents as bytes.
fs.write()
Example
Example
Parameters
pathStringGuest path.
dataStringFile contents as bytes.
Returns
nil
No return value.
fs.mkdir()
Parameters
pathStringGuest path.
Returns
nil
No return value.
fs.list()
Parameters
pathStringGuest path.
Returns
Array<Hash>
Directory entries.
fs.stat()
Parameters
pathStringGuest path.
Returns
Hash
File metadata.
fs.exists?()
Parameters
pathStringGuest path.
Returns
Boolean
Whether the path exists.
fs.copy()
Parameters
fromStringSource guest path.
toStringDestination guest path.
Returns
nil
No return value.
fs.rename()
Parameters
fromStringSource guest path.
toStringDestination guest path.
Returns
nil
No return value.
fs.remove()
Parameters
pathStringGuest path.
Returns
nil
No return value.
fs.remove_dir()
Parameters
pathStringGuest path.
Returns
nil
No return value.
fs.copy_from_host()
Parameters
host_pathStringPath on the host.
guest_pathStringPath inside the guest.
Returns
nil
No return value.
fs.copy_to_host()
Example
Example
Parameters
guest_pathStringPath inside the guest.
host_pathStringPath on the host.
Returns
nil
No return value.
Metadata
Hashes use string keys. Optional timestamps are omitted when unavailable. Ruby does not expose streaming filesystem handles.Fields
”path”StringEntry path; returned by list.
”kind”Stringfile, directory, symlink, or other.
”size”IntegerSize in bytes.
”mode”IntegerFile mode.
”uid”, “gid”IntegerOwner and group IDs.
”modified”, “accessed”StringRFC 3339 timestamps, when available.
”readonly”BooleanReturned by stat.
”created”StringCreation timestamp, when available from stat.