mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Adds the node:vfs builtin module with VirtualFileSystem and provider classes. No integration with fs, modules, or SEA. Assisted-by: Claude-Opus4.7 Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/63115 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
25 lines
645 B
JavaScript
25 lines
645 B
JavaScript
// Flags: --experimental-vfs
|
|
'use strict';
|
|
|
|
// VFS stats must have non-zero, unique ino and a distinctive dev.
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const vfs = require('node:vfs');
|
|
|
|
const myVfs = vfs.create();
|
|
myVfs.writeFileSync('/f1.txt', 'a');
|
|
myVfs.writeFileSync('/f2.txt', 'b');
|
|
|
|
const s1 = myVfs.statSync('/f1.txt');
|
|
const s2 = myVfs.statSync('/f2.txt');
|
|
|
|
// Dev should be distinctive VFS value (4085 = 0xVF5)
|
|
assert.strictEqual(s1.dev, 4085);
|
|
assert.strictEqual(s2.dev, 4085);
|
|
|
|
// Ino should be unique per call
|
|
assert.notStrictEqual(s1.ino, 0);
|
|
assert.notStrictEqual(s2.ino, 0);
|
|
assert.notStrictEqual(s1.ino, s2.ino);
|