Skip to content

Commit

Permalink
test: change function to write to file
Browse files Browse the repository at this point in the history
Co-authored-by: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
emilsivervik and RaisinTen committed Jan 25, 2021
1 parent 622ed80 commit 937c371
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/parallel/test-fs-promises-file-handle-readFile.js
Expand Up @@ -6,7 +6,12 @@ const common = require('../common');
// FileHandle.readFile method.

const fs = require('fs');
const { open, readFile, writeFile } = fs.promises;
const {
open,
readFile,
writeFile,
truncate
} = fs.promises;
const path = require('path');
const tmpdir = require('../common/tmpdir');
const tick = require('../common/tick');
Expand Down Expand Up @@ -97,8 +102,8 @@ async function doReadAndCancel() {
const kIoMaxLength = 2 ** 31 - 1;

const newFile = path.resolve(tmpDir, 'dogs-running3.txt');
const buffer = Buffer.alloc(kIoMaxLength + 1);
await writeFile(newFile, buffer);
await writeFile(newFile, Buffer.from('0'));
await truncate(newFile, kIoMaxLength + 1);

const fileHandle = await open(newFile, 'r');

Expand Down

0 comments on commit 937c371

Please sign in to comment.