|
1 | | -# <center>Welcome to use-file-picker</center> |
| 1 | +# <center>Welcome to use-file-picker 👋</center> |
2 | 2 |
|
3 | 3 | ## _Simple react hook to open browser file selector._ |
4 | 4 |
|
5 | | -[](https://www.npmjs.com/package/use-file-picker) [](#) [](https://twitter.com/twitter.com/JankiewiczMi) |
| 5 | +[](https://www.npmjs.com/package/use-file-picker) [](#) [](https://twitter.com/twitter.com/jaaneek) |
6 | 6 |
|
7 | | -**🏠 [Homepage](https://github.com/Jaaneek/useFilePicker 'user-file-picker Github')** |
| 7 | +**🏠 [Homepage](https://github.com/Jaaneek/useFilePicker 'use-file-picker Github')** |
8 | 8 |
|
9 | 9 | ## Documentation |
10 | 10 |
|
@@ -87,7 +87,7 @@ export default function App() { |
87 | 87 | multiple: true, |
88 | 88 | validators: [ |
89 | 89 | new FileAmountLimitValidator({ max: 1 }), |
90 | | - new FileSizeValidator({ maxFileSize: 50 /* in megabytes */ }), |
| 90 | + new FileSizeValidator({ maxFileSize: 50 * 1024 * 1024 /* 50 MB */ }), |
91 | 91 | new ImageDimensionsValidator({ |
92 | 92 | maxHeight: 900, // in pixels |
93 | 93 | maxWidth: 1600, |
@@ -349,17 +349,17 @@ const Imperative = () => { |
349 | 349 | | -------------- | ---------------------------------------------------------------------------------------- | |
350 | 350 | | openFilePicker | Opens file selector | |
351 | 351 | | clear | Clears all files and errors | |
352 | | -| filesContent | Get files array of type FileContent | |
| 352 | +| filesContent | Get files array of type FileContent | |
353 | 353 | | plainFiles | Get array of the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) objects | |
354 | 354 | | loading | True if the reading files is in progress, otherwise False | |
355 | | -| errors | Get errors array of type FileError if any appears | |
| 355 | +| errors | Get errors array of type FileError if any appears | |
356 | 356 |
|
357 | 357 | ### Built-in validators |
358 | 358 |
|
359 | 359 | useFilePicker has some built-in validators that can be used out of the box. These are: |
360 | 360 |
|
361 | 361 | - FileAmountLimitValidator - allows to select a specific number of files (min and max) that will pass validation. This will work great with simple useFilePicker use cases, it will run on every file selection. |
362 | | -- FileSizeValidator - allows to select files of a specific size (min and max) that will pass validation. |
| 362 | +- FileSizeValidator - allows to select files of a specific size (min and max) in bytes that will pass validation. |
363 | 363 | - ImageDimensionsValidator - allows to select images of a specific size (min and max) that will pass validation. |
364 | 364 | - PersistentFileAmountLimitValidator - allows to select a specific number of files (min and max) that will pass validation but it takes into consideration the previously selected files. This will work great with useImperativeFilePicker hook when you want to keep track of how many files are selected even when user is allowed to trigger selection multiple times before submitting the files. |
365 | 365 |
|
|
0 commit comments