Skip to content

Commit

Permalink
fix(web): cannot upload folder with more than 100 files (#14284)
Browse files Browse the repository at this point in the history
* fix: web cannot upload folder with more than 100 files

* recursively call the function

* async/do/while
  • Loading branch information
alextran1502 authored Nov 22, 2024
1 parent 1c82804 commit 6d49298
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,25 @@
});
};
const readEntriesAsync = (reader: FileSystemDirectoryReader) => {
return new Promise<FileSystemEntry[]>((resolve, reject) => {
reader.readEntries(resolve, reject);
});
};
const getContentsFromFileSystemDirectoryEntry = async (
fileSystemDirectoryEntry: FileSystemDirectoryEntry,
): Promise<FileSystemEntry[]> => {
return new Promise((resolve, reject) => {
const reader = fileSystemDirectoryEntry.createReader();
reader.readEntries(resolve, reject);
});
const reader = fileSystemDirectoryEntry.createReader();
const files: FileSystemEntry[] = [];
let entries: FileSystemEntry[];
do {
entries = await readEntriesAsync(reader);
files.push(...entries);
} while (entries.length > 0);
return files;
};
const handleFiles = async (files?: FileList | File[]) => {
Expand Down

0 comments on commit 6d49298

Please sign in to comment.