test: address deprecation warning

fs.truncateSync() emits a deprecation warning when called with a file
descriptor. Move to fs.ftruncateSync().

PR-URL: https://github.com/nodejs/node/pull/38448
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Rich Trott authored and Michaël Zasso committed 2021-06-11 09:30:11 +02:00
1 parent 8258799472
commit fdfb39e692
1 file changed
+1 -1
+1 -1
View File
@@ -34,7 +34,7 @@ const fd = fs.openSync(filepath, 'w+');
const offset = 5 * 1024 * 1024 * 1024; // 5GB
const message = 'Large File';
fs.truncateSync(fd, offset);
fs.ftruncateSync(fd, offset);
assert.strictEqual(fs.statSync(filepath).size, offset);
const writeBuf = Buffer.from(message);
fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset);