INNER CODE UNIT · TypeScript

traverseEntry

WorldQL/dreamlab-engine · editor/client/main.ts:137

  async function traverseEntry(entry: FileSystemEntry): Promise<void> {
    if (entry.isFile) {
      const fileEntry = entry as FileSystemFileEntry;
      const file: File = await new Promise((res, rej) => fileEntry.file(res, rej));

      fileCount++;
      if (fileCount > MAX_FILES) {
        throw new Error(`Too many files. Maximum ${MAX_FILES} files allowed.`);
      }

      const ext = file.name.split(".").pop()?.toLowerCase() || "";
      const topFolder = mediaExts.has(ext) ? "assets" : "src";

      const relative = entry.fullPath.replace(/^\/+/, "");
      const destPath = relative.startsWith(`${topFolder}/`)
        ? relative
        : `${topFolder}/${relative}`;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…