Skip to content

Commit 4726b7f

Browse files
committed
doc: alphabetize VirtualFileSystem members in vfs.md
1 parent aa19193 commit 4726b7f

1 file changed

Lines changed: 50 additions & 50 deletions

File tree

doc/api/vfs.md

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -175,27 +175,36 @@ added: REPLACEME
175175

176176
Creates a new `VirtualFileSystem` instance.
177177

178-
### `vfs.provider`
178+
### `vfs.chdir(path)`
179179

180180
<!-- YAML
181181
added: REPLACEME
182182
-->
183183

184-
* {VirtualProvider}
184+
* `path` {string} The new working directory path within the VFS.
185185

186-
The underlying provider for this VFS instance. Can be used to access
187-
provider-specific methods like `setReadOnly()` for `MemoryProvider`.
186+
Changes the virtual working directory. This only affects path resolution within
187+
the VFS when `virtualCwd` is enabled in the constructor options.
188188

189-
```cjs
190-
const vfs = require('node:vfs');
189+
Throws `ERR_INVALID_STATE` if `virtualCwd` was not enabled during construction.
191190

192-
const myVfs = vfs.create();
191+
When mounted with `virtualCwd` enabled, the VFS also hooks `process.chdir()` and
192+
`process.cwd()` to support virtual paths transparently. In Worker threads,
193+
`process.chdir()` to virtual paths will work, but attempting to change to real
194+
file system paths will throw `ERR_WORKER_UNSUPPORTED_OPERATION`.
193195

194-
// Access the provider
195-
console.log(myVfs.provider.readonly); // false
196-
myVfs.provider.setReadOnly();
197-
console.log(myVfs.provider.readonly); // true
198-
```
196+
### `vfs.cwd()`
197+
198+
<!-- YAML
199+
added: REPLACEME
200+
-->
201+
202+
* Returns: {string|null}
203+
204+
Returns the current virtual working directory, or `null` if no virtual directory
205+
has been set yet.
206+
207+
Throws `ERR_INVALID_STATE` if `virtualCwd` was not enabled during construction.
199208

200209
### `vfs.mount(prefix)`
201210

@@ -226,26 +235,25 @@ myVfs.mount('/virtual');
226235
require('node:fs').readFileSync('/virtual/data.txt', 'utf8'); // 'Hello'
227236
```
228237

229-
### `vfs.unmount()`
238+
### `vfs.mounted`
230239

231240
<!-- YAML
232241
added: REPLACEME
233242
-->
234243

235-
Unmounts the virtual file system. After unmounting, virtual files are no longer
236-
accessible through the `fs` module. The VFS can be remounted at the same or a
237-
different path by calling `mount()` again. Unmounting also resets the virtual
238-
working directory if one was set.
244+
* {boolean}
239245

240-
### `vfs.mounted`
246+
Returns `true` if the VFS is currently mounted.
247+
248+
### `vfs.mountPoint`
241249

242250
<!-- YAML
243251
added: REPLACEME
244252
-->
245253

246-
* {boolean}
254+
* {string | null}
247255

248-
Returns `true` if the VFS is currently mounted.
256+
The current mount point, or `null` if not mounted.
249257

250258
### `vfs.overlay`
251259

@@ -259,56 +267,48 @@ Returns `true` if overlay mode is enabled. In overlay mode, the VFS only
259267
intercepts paths that exist in the VFS, allowing other paths to fall through
260268
to the real file system.
261269

262-
### `vfs.mountPoint`
270+
### `vfs.provider`
263271

264272
<!-- YAML
265273
added: REPLACEME
266274
-->
267275

268-
* {string | null}
269-
270-
The current mount point, or `null` if not mounted.
276+
* {VirtualProvider}
271277

272-
### `vfs.readonly`
278+
The underlying provider for this VFS instance. Can be used to access
279+
provider-specific methods like `setReadOnly()` for `MemoryProvider`.
273280

274-
<!-- YAML
275-
added: REPLACEME
276-
-->
281+
```cjs
282+
const vfs = require('node:vfs');
277283

278-
* {boolean}
284+
const myVfs = vfs.create();
279285

280-
Returns `true` if the underlying provider is read-only.
286+
// Access the provider
287+
console.log(myVfs.provider.readonly); // false
288+
myVfs.provider.setReadOnly();
289+
console.log(myVfs.provider.readonly); // true
290+
```
281291

282-
### `vfs.chdir(path)`
292+
### `vfs.readonly`
283293

284294
<!-- YAML
285295
added: REPLACEME
286296
-->
287297

288-
* `path` {string} The new working directory path within the VFS.
289-
290-
Changes the virtual working directory. This only affects path resolution within
291-
the VFS when `virtualCwd` is enabled in the constructor options.
292-
293-
Throws `ERR_INVALID_STATE` if `virtualCwd` was not enabled during construction.
298+
* {boolean}
294299

295-
When mounted with `virtualCwd` enabled, the VFS also hooks `process.chdir()` and
296-
`process.cwd()` to support virtual paths transparently. In Worker threads,
297-
`process.chdir()` to virtual paths will work, but attempting to change to real
298-
file system paths will throw `ERR_WORKER_UNSUPPORTED_OPERATION`.
300+
Returns `true` if the underlying provider is read-only.
299301

300-
### `vfs.cwd()`
302+
### `vfs.unmount()`
301303

302304
<!-- YAML
303305
added: REPLACEME
304306
-->
305307

306-
* Returns: {string|null}
307-
308-
Returns the current virtual working directory, or `null` if no virtual directory
309-
has been set yet.
310-
311-
Throws `ERR_INVALID_STATE` if `virtualCwd` was not enabled during construction.
308+
Unmounts the virtual file system. After unmounting, virtual files are no longer
309+
accessible through the `fs` module. The VFS can be remounted at the same or a
310+
different path by calling `mount()` again. Unmounting also resets the virtual
311+
working directory if one was set.
312312

313313
### File System Methods
314314

@@ -328,10 +328,10 @@ including `string`, `Buffer`, `TypedArray`, and `DataView` where applicable.
328328
* `vfs.lstatSync(path[, options])` - Get file stats (no symlink follow)
329329
* `vfs.mkdirSync(path[, options])` - Create a directory
330330
* `vfs.openSync(path, flags[, mode])` - Open a file
331+
* `vfs.readdirSync(path[, options])` - Read directory contents
331332
* `vfs.readFileSync(path[, options])` - Read a file
332-
* `vfs.readSync(fd, buffer, offset, length, position)` - Read from fd
333333
* `vfs.readlinkSync(path[, options])` - Read symlink target
334-
* `vfs.readdirSync(path[, options])` - Read directory contents
334+
* `vfs.readSync(fd, buffer, offset, length, position)` - Read from fd
335335
* `vfs.realpathSync(path[, options])` - Resolve symlinks
336336
* `vfs.renameSync(oldPath, newPath)` - Rename a file or directory
337337
* `vfs.rmdirSync(path)` - Remove a directory

0 commit comments

Comments
 (0)