mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Enable node:vfs by default. --no-experimental-vfs disables node:vfs exposure and --vfs-load. Assisted-by: pi Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/66318 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
20 lines
528 B
JavaScript
20 lines
528 B
JavaScript
// Flags: --disable-warning=ExperimentalWarning
|
|
'use strict';
|
|
|
|
// writeSync in append mode must append, not overwrite.
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const vfs = require('node:vfs');
|
|
|
|
const myVfs = vfs.create();
|
|
myVfs.writeFileSync('/append.txt', 'init');
|
|
|
|
const fd = myVfs.openSync('/append.txt', 'a');
|
|
const buf = Buffer.from(' more');
|
|
myVfs.writeSync(fd, buf, 0, buf.length);
|
|
myVfs.closeSync(fd);
|
|
|
|
const content = myVfs.readFileSync('/append.txt', 'utf8');
|
|
assert.strictEqual(content, 'init more');
|