mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
node:module compatibility pt 1 (#18106)
This commit is contained in:
@@ -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.
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user