(data: FileData)
| 452 | return toFileInfo(entry); |
| 453 | }; |
| 454 | const fileRead = async (data: FileData): Promise<FileData> => { |
| 455 | const info = await fileInfo(data); |
| 456 | if (info.notfound) { |
| 457 | return { info }; |
| 458 | } |
| 459 | const entry = getEntry(info.path); |
| 460 | if (entry.isdir) { |
| 461 | const childEntries = (childrenByDir.get(entry.path) ?? []).map((child) => toFileInfo(child)); |
| 462 | return { info, entries: childEntries }; |
| 463 | } |
| 464 | if (entry.content == null || entry.content.byteLength === 0) { |
| 465 | return { info }; |
| 466 | } |
| 467 | const { offset, end } = getReadRange(data, entry.content.byteLength); |
| 468 | return { |
| 469 | info, |
| 470 | data64: arrayToBase64(entry.content.slice(offset, end)), |
| 471 | at: { offset, size: end - offset }, |
| 472 | }; |
| 473 | }; |
| 474 | const fileList = async (data: FileListData): Promise<FileInfo[]> => { |
| 475 | const dirPath = normalizeMockPath(data?.path ?? MockHomePath); |
| 476 | const entry = getEntry(dirPath); |
nothing calls this directly
no test coverage detected