MCPcopy Create free account
hub / github.com/ShouChenICU/FastSend / dealFilesFromHandlerLoop

Function dealFilesFromHandlerLoop

app/utils/files.ts:1–20  ·  view source on GitHub ↗
(
  fh: FileSystemFileHandle | FileSystemDirectoryHandle,
  paths: Array<string>,
  result: any
)

Source from the content-addressed store, hash-verified

1async function dealFilesFromHandlerLoop(
2 fh: FileSystemFileHandle | FileSystemDirectoryHandle,
3 paths: Array<string>,
4 result: any
5) {
6 if (fh.kind === 'file') {
7 const file = await fh.getFile()
8 result[paths.join('/')] = {
9 paths: [...paths],
10 size: file.size,
11 lastModified: file.lastModified,
12 file: file
13 }
14 } else if (fh.kind === 'directory') {
15 // @ts-ignore
16 for await (const fh1 of fh.entries()) {
17 await dealFilesFromHandlerLoop(fh1[1], [...paths, fh1[0]], result)
18 }
19 }
20}
21
22/**
23 *

Callers 1

dealFilesFromHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected