https://github.com/cometkim/react-directory-input
A simple component to handle a directory as a single file
https://github.com/cometkim/react-directory-input
Last synced: 7 months ago
JSON representation
A simple component to handle a directory as a single file
- Host: GitHub
- URL: https://github.com/cometkim/react-directory-input
- Owner: cometkim
- License: mit
- Created: 2022-06-14T18:06:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T17:43:03.000Z (over 2 years ago)
- Last Synced: 2024-10-29T14:44:24.694Z (over 1 year ago)
- Language: TypeScript
- Size: 819 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-directory-input
A simple component to handle a directory as a single file
## Example
```tsx
import * as React from 'react';
import { ReactDirectoryZipInput } from 'react-directory-input';
function DirectoryUpload() {
const [isProcessing, setIsProcessing] = React.useState(false);
const [upload, setUpload] = React.useState(null);
return (
{
setIsProcessing(true);
}}
onArchivingResult={({ result }) => {
setUpload(result);
setIsProcessing(false);
}}
/>
);
}
```
## Note about using form
There is no way to manipulate state of file input from JavaScript for security reason, which is I didn't noticed when implementing it.
When to try using form, **you should override default form submit handler** to build your own FormData, or it is always empty file value.
## LICENSE
MIT