Interface: BundleHandle¶
Properties¶
name¶
Bundle directory name (used as default doc name when frontmatter
omits metadata.name).
path¶
Filesystem path when the handle wraps a real directory; null
otherwise. ESCAPE HATCH — prefer explicit read/write/iter methods.
Use only when an external library demands a real path (e.g.
fs.cp, third-party tooling).
Methods¶
exists()¶
True if the named entry (file or directory) exists in this bundle.
Parameters¶
| Parameter | Type |
|---|---|
entry |
string |
Returns¶
Promise\<boolean>
isFile()¶
True if entry points at a regular file (not a directory).
Parameters¶
| Parameter | Type |
|---|---|
entry |
string |
Returns¶
Promise\<boolean>
iterEntries()¶
Yield entry names (relative to the bundle root).
When recursive=false (default), only direct children are
yielded — both regular files and subdirectories.
When recursive=true, descend into subdirectories yielding only
regular files (no directory entries).
Parameters¶
| Parameter | Type |
|---|---|
recursive? |
boolean |
Returns¶
Promise\<string[]>
readBytes()¶
Read entry content as bytes. Throws if absent.
Parameters¶
| Parameter | Type |
|---|---|
entry |
string |
Returns¶
Promise\<Uint8Array\<ArrayBufferLike>>
readText()¶
Read entry content as text. Throws if absent.
Parameters¶
| Parameter | Type |
|---|---|
entry |
string |
encoding? |
BufferEncoding |
Returns¶
Promise\<string>
writeBytes()¶
Write bytes. Read-only handles throw.
Parameters¶
| Parameter | Type |
|---|---|
entry |
string |
content |
Uint8Array |
Returns¶
Promise\<void>
writeText()¶
Write text content. Read-only handles throw.
Parameters¶
| Parameter | Type |
|---|---|
entry |
string |
content |
string |
encoding? |
BufferEncoding |
Returns¶
Promise\<void>