From d01c859cd3a68d0d0da793aa93a7a790baf506fb Mon Sep 17 00:00:00 2001 From: filipenevola Date: Fri, 24 Jul 2020 07:43:35 -0400 Subject: [PATCH] fixes ts error on files.ts --- tools/fs/files.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/fs/files.ts b/tools/fs/files.ts index ac9cf630f6..b5e2e81019 100644 --- a/tools/fs/files.ts +++ b/tools/fs/files.ts @@ -1538,13 +1538,13 @@ export function readBufferWithLengthAndOffset( if (length > 0) { const fd = open(filename, "r"); try { - var count = read(fd, data, 0, length, offset); + const count = read(fd, data, { position: 0, length, offset }); + if (count !== length) { + throw new Error("couldn't read entire resource"); + } } finally { close(fd); } - if (count !== length) { - throw new Error("couldn't read entire resource"); - } } return data; }