node:module compatibility pt 1 (#18106)

This commit is contained in:
chloe caruso
2025-03-12 15:47:41 -07:00
committed by GitHub
parent d2ecce272c
commit 85376147a4
29 changed files with 483 additions and 159 deletions

View File

@@ -64,3 +64,12 @@ fn findPathInner(
);
return errorable.unwrap() catch null;
}
pub fn _stat(path: []const u8) i32 {
const exists = bun.sys.existsAtType(.cwd(), path).unwrap() catch
return -1; // Returns a negative integer for any other kind of strings.
return switch (exists) {
.file => 0, // Returns 0 for files.
.directory => 1, // Returns 1 for directories.
};
}