Typical flow
Static methods
Volume.builder()
Example
Example
.disk().size(...) for a disk-backed volume. See VolumeBuilder for all options.
Parameters
namestringReturns
Volume.get()
Example
Example
.fs() and .remove(), unlike the read-only handles returned by list().
Parameters
namestringReturns
Volume.list()
Example
Example
.fs() or .remove() on them throws. Call Volume.get(name) to upgrade to a live handle.
Returns
Volume.remove()
Example
Example
Parameters
namestringInstance methods
volume.name
Returns
volume.path
~/.microsandbox/volumes/<name>/.
Returns
volume.fs()
Example
Example
VolumeFs for the full API.
Returns
VolumeBuilder
Fluent builder for a named volume. Obtained viaVolume.builder(name). Directory-backed volumes are the default; call disk() plus size() for a disk-backed volume. Every setter returns the builder, so calls chain.
.directory()
.disk()
Example
Example
size() to set the capacity.
.size()
disk().
Parameters
mibnumber.quota()
Parameters
mibnumber.label()
Parameters
keystringvaluestring.build()
create() instead. The returned config object is the internal NapiVolumeConfig shape (not a public export).
Returns
.create()
Example
Example
Volume.
Returns
VolumeFs methods
Host-side filesystem operations on a volume’s directory. Obtained viavolume.fs() or VolumeHandle.fs(). All operations run directly on the host without booting a sandbox. Paths are relative to the volume’s root directory. Every method is async.
vfs.read()
Example
Example
Parameters
pathstringReturns
vfs.readToString()
Example
Example
Parameters
pathstringReturns
vfs.readStream()
Example
Example
Parameters
pathstringReturns
vfs.write()
Example
Example
Parameters
pathstringdataUint8Array | stringvfs.writeStream()
Example
Example
Parameters
pathstringReturns
close() when done.vfs.list()
Example
Example
"" for the volume root.
Parameters
pathstringReturns
vfs.mkdir()
Example
Example
Parameters
pathstringvfs.removeDir()
Example
Example
Parameters
pathstringvfs.remove()
Example
Example
Parameters
pathstringvfs.copy()
Example
Example
Parameters
fromstringtostringvfs.rename()
Example
Example
Parameters
fromstringtostringvfs.stat()
Example
Example
Parameters
pathstringReturns
vfs.exists()
Example
Example
Parameters
pathstringReturns
true if the path exists.Types
VolumeHandle
Returned by Volume.get() · Volume.list()
A handle to an existing named volume, carrying its metadata. Handles fromVolume.get() are live: .fs() and .remove() work. Handles in the array from Volume.list() are read-only: those two methods throw, so call Volume.get(name) to upgrade.
VolumeFs
Returned by volume.fs() · VolumeHandle.fs()
Host-side filesystem operations on a volume’s directory. The methods mirrorSandboxFsOps but run directly on the host with no sandbox booted. See the VolumeFs methods section above for full per-method details.
VolumeFsReadStream
Returned by VolumeFs.readStream()
A streaming reader over a volume file. ImplementsAsyncIterable<Uint8Array> and AsyncDisposable, so it works with for await and using.
VolumeFsWriteSink
Returned by VolumeFs.writeStream()
A streaming writer for a volume file. ImplementsAsyncDisposable, so await using closes it automatically.