| 288 | const isPendingCreate = (path: string): boolean => files.get(path)?.pendingCreate === true; |
| 289 | const exists = (path: string): boolean => isPendingCreate(path) || vfs.existsSync(toVfs(path)); |
| 290 | const getBufferStats = (): FuseBufferStats => { |
| 291 | let dirtyEntries = 0; |
| 292 | let pendingCreates = 0; |
| 293 | let capacityBytes = 0; |
| 294 | let logicalBytes = 0; |
| 295 | let dirtyLogicalBytes = 0; |
| 296 | for (const entry of files.values()) { |
| 297 | if (entry.dirty) dirtyEntries++; |
| 298 | if (entry.pendingCreate) pendingCreates++; |
| 299 | capacityBytes += entry.buf.byteLength; |
| 300 | logicalBytes += entry.size; |
| 301 | if (entry.dirty) dirtyLogicalBytes += entry.size; |
| 302 | } |
| 303 | return { |
| 304 | entries: files.size, |
| 305 | dirtyEntries, |
| 306 | pendingCreates, |
| 307 | capacityBytes, |
| 308 | logicalBytes, |
| 309 | dirtyLogicalBytes, |
| 310 | openHandles: handles.size, |
| 311 | openPaths: fileOpenCounts.size, |
| 312 | }; |
| 313 | }; |
| 314 | |
| 315 | const pendingStat = (entry: FileEntry): FuseStat => { |
| 316 | return { |