Skip to content

Instantly share code, notes, and snippets.

@koyanloshe
Forked from kmoskwiak/read.js
Created January 24, 2021 09:13
Show Gist options
  • Save koyanloshe/f13b07d14ab5e9a11ea4447cb97be495 to your computer and use it in GitHub Desktop.
Save koyanloshe/f13b07d14ab5e9a11ea4447cb97be495 to your computer and use it in GitHub Desktop.
read with shared buffer
function readBytes(fd, sharedBuffer) {
return new Promise((resolve, reject) => {
fs.read(
fd,
sharedBuffer,
0,
sharedBuffer.length,
null,
(err) => {
if(err) { return reject(err); }
resolve();
}
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment