Skip to content

Commit

Permalink
fix: cannot read R_OK from undefined (node < 18.4.0) (#96)
Browse files Browse the repository at this point in the history
* fix: use constants.R_OK from node:constants instead of node:fs/promises

* add changeset
  • Loading branch information
ACHP committed Sep 16, 2023
1 parent 99055ac commit 04db823
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tough-cougars-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"skott": patch
---

fsPromises.constants is undefined for node < 18.4.0
2 changes: 1 addition & 1 deletion packages/skott/src/filesystem/file-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class FileSystemReader implements FileReader {

exists(filename: string) {
return fs
.access(filename, fs.constants.R_OK)
.access(filename, R_OK)
.then(() => true)
.catch(() => false);
}
Expand Down

0 comments on commit 04db823

Please sign in to comment.