Volume
Creation, lookup and list items return the sameVolume type. Each resource retains its destination and stable identity. Dropping it does not delete storage.
volume.id
string
An opaque identity for this connection. Reading it does not contact the backend. A replacement with the same name has a different identity.
Instance properties
volume.name
string
The volume’s name.
volume.path
string
Absolute host path to the volume’s directory. By default volumes live under ~/.microsandbox/volumes/<name>/.
Static methods
Volume.getDefault()
.fs().
The local backend returns a typed Unsupported error; it never substitutes a directory from the caller’s machine.
Example
Example
Volume.builder()
Example
Example
.disk().size(...) for a disk-backed volume. See VolumeBuilder for all options.
Parameters
namestringReturns
Volume.get()
Example
Example
destroy().
Parameters
namestringReturns
Volume.list()
Example
Example
Volume, retaining its identity and context for .fs() and .destroy() without another lookup.
Returns
Volume.remove()
Example
Example
Parameters
namestringInstance methods
volume.fs()
Example
Example
VolumeFs for the full API.
Returns
volume.kind
VolumeKind
Both the getter and the live observation use "dir" or "disk".
volume.diskFormat
string \| null
Disk image format (disk volumes)
volume.diskFstype
string \| null
Inner disk filesystem (disk volumes)
volume.info()
null. Lookup failures are returned without captured fallback. A deleted or replaced volume fails inspection. The result also includes identity, name, kind, default-volume status, disk format/filesystem, and creation time.
volume.createdAt
Date \| null
Creation timestamp
volume.destroy()
Returns
Promise<void>
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.
volumeBuilder.directory()
volumeBuilder.disk()
Example
Example
size() to set the capacity.
volumeBuilder.size()
disk().
Parameters
mibnumbervolumeBuilder.quota()
Parameters
mibnumbervolumeBuilder.label()
Parameters
keystringvaluestringvolumeBuilder.build()
create() instead. The returned config object is the internal NapiVolumeConfig shape (not a public export).
Returns
volumeBuilder.create()
Example
Example
Volume.
Returns
VolumeFs
Returned by volume.fs() · Volume.fs()
Host-side filesystem operations for a named volume.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.VolumeFsReadStream
Returned by VolumeFs.readStream()
A streaming reader over a volume file. ImplementsAsyncIterable<Uint8Array> and AsyncDisposable, so it works with for await and using.
stream.recv()
null when the stream is exhausted
Returns
Promise<Uint8Array \| null>
stream.collect()
Returns
Promise<Uint8Array>
stream.Symbol.asyncIterator
for await
Returns
AsyncIterator<Uint8Array>
stream.Symbol.asyncDispose
using)
Returns
Promise<void>
VolumeFsWriteSink
Returned by VolumeFs.writeStream()
A streaming writer for a volume file. ImplementsAsyncDisposable, so await using closes it automatically.
sink.write()
Uint8Array or UTF-8 string)
Returns
Promise<void>
sink.close()
Returns
Promise<void>
sink.Symbol.asyncDispose
await using)
Returns
Promise<void>
MountBuilder
mount.owned()
OwnedVolumeOptions accepts kind ("dir" by default or "disk"), quotaMib for directories, and sizeMib for disks. Disks require a positive capacity and use raw ext4. Common mount flags remain on MountBuilder; owner() and metadata policies apply only to directories.
mount.owner()
0 through 4294967295. Host inode ownership is unchanged. Unsupported for tmpfs, disk mounts, and statVirtualization("off").