@fgv/ts-web-extras
Version:
Browser-compatible utilities and FileTree implementations
73 lines (34 loc) • 1.25 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileApiTreeAccessors](./ts-web-extras.fileapitreeaccessors.md) > [fromDirectoryUpload](./ts-web-extras.fileapitreeaccessors.fromdirectoryupload.md)
## FileApiTreeAccessors.fromDirectoryUpload() method
Create FileTree from directory upload with webkitRelativePath.
**Signature:**
```typescript
static fromDirectoryUpload<TCT extends string = string>(fileList: FileList, params?: FileTree.IFileTreeInitParams<TCT>): Promise<Result<FileTree.FileTree<TCT>>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileList
</td><td>
FileList
</td><td>
FileList from a directory upload (input with webkitdirectory)
</td></tr>
<tr><td>
params
</td><td>
FileTree.IFileTreeInitParams<TCT>
</td><td>
_(Optional)_ Optional `IFileTreeInitParams` for the file tree.
</td></tr>
</tbody></table>
**Returns:**
Promise<Result<FileTree.FileTree<TCT>>>
Promise resolving to a FileTree with all content pre-loaded