INNER CODE UNIT · TypeScript

selectedFiles

SimonAKing/scrcpy-gui · src/main/main.ts:380

async function selectedFiles(paths: string[], extensions?: Set<string>): Promise<SelectedLocalFile[]> {
  if (paths.length < 1 || paths.length > 50) throw new TypeError('Select 1 to 50 files.')
  return Promise.all(paths.map(async (path) => {
    const info = await stat(path)
    const name = basename(path)
    if (!info.isFile()) throw new TypeError(`${name} is not a regular file.`)
    if (extensions && !extensions.has(extname(name).toLowerCase())) throw new TypeError(`${name} is not a supported package file.`)
    return { path, name, size: info.size }
  }))
}

async function prepareDiagnostics(runtime: RuntimeConfig, allowDraft: boolean): Promise<PreparedDiagnostics> {
  const validatedRuntime = runtimeConfig(runtime)
  const runtimeKey = JSON.stringify(validatedRuntime)
  if (allowDraft && diagnosticDraft?.runtimeKey === runtimeKey && Date.now() - diagnosticDraft.createdAt < 10 * 60_000) {
    return diagnosticDraft.prepared
  }
  const context: DiagnosticContext = {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…