(stat: {
mtime: Date;
atime: Date;
ctime: Date;
size: number;
mode: number;
nlink?: number;
ino?: number;
blksize?: number;
blocks?: number;
isDirectory(): boolean;
})
| 1049 | } |
| 1050 | |
| 1051 | function statNode(stat: { |
| 1052 | mtime: Date; |
| 1053 | atime: Date; |
| 1054 | ctime: Date; |
| 1055 | size: number; |
| 1056 | mode: number; |
| 1057 | nlink?: number; |
| 1058 | ino?: number; |
| 1059 | blksize?: number; |
| 1060 | blocks?: number; |
| 1061 | isDirectory(): boolean; |
| 1062 | }): FuseStat { |
| 1063 | return { |
| 1064 | mtime: stat.mtime, |
| 1065 | atime: stat.atime, |
| 1066 | ctime: stat.ctime, |
| 1067 | size: stat.size, |
| 1068 | mode: stat.mode, |
| 1069 | uid: typeof process.getuid === "function" ? process.getuid() : 0, |
| 1070 | gid: typeof process.getgid === "function" ? process.getgid() : 0, |
| 1071 | nlink: stat.nlink ?? (stat.isDirectory() ? 2 : 1), |
| 1072 | ino: stat.ino ?? 0, |
| 1073 | // Prefer provider-supplied block accounting when the VFS exposes |
| 1074 | // it; otherwise derive from size in 512-byte units so `du` and |
| 1075 | // other st_blocks consumers see real usage. |
| 1076 | blksize: stat.blksize ?? PREFERRED_IO_BLOCK_SIZE, |
| 1077 | blocks: stat.blocks ?? blocksForSize(stat.size), |
| 1078 | }; |
| 1079 | } |
| 1080 | |
| 1081 | function toErrno(error: unknown): number { |
| 1082 | const code = |
no test coverage detected