
Security News
Feross on TBPN: Socket's Series C and the State of Software Supply Chain Security
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.
@n3/react-fileuploader
Advanced tools
npm install @n3/react-fileuploader
import FileUploader from '@n3/react-fileuploader';
...
<FileUploader
files={files}
isShow={isShow}
disabled={disabled}
multiple={multiple}
help={help}
renderFile={renderFile}
uploadFile={uploadFile}
onChange={onChangeFiles}
showDownloadControl={showDownloadControl}
showRemoveControl={showRemoveControl}
getControls={getControls}
isDragAndDrop={isDragAndDrop}
/>
files - обязательное, массив файлов вида:
id: String | Number - обязательное, id файлаname: String - обязательное, название файлаurl: String - ссылка на скачивание файлаsize: Number - размер файла в байтахextension: String - расширение файлаuploadErrors: any - ошибки при загрузке файлаisShow: Boolean - включен ли режим просмотра (отображается только список файлов, по умолчанию нет кнопки удаления), по умолчанию false
disabled: Boolean - выключено ли поле ввода, по умолчанию false
multiple: Boolean - возможен ли выбор нескольких файлов в инпуте, по умолчанию true
help: React Node - контент блока справа от кнопки, по умолчанию null
inputProps: Object - объект дополнительных свойств для input[type="file"] элемента
renderFile: (fileId, props, FileBlockComponent, index) => Element - функция для переопределения рендера загруженных или загружающихся файлов. FileBlockComponent - оригинальный компонент для рендера лейбла файла, props - оригинальные props, которые принимает FileBlockComponent, fileId - id файла, index - индекс файла в списке. Если props.mode = "submitting", то это список загружающихся файлов, если "ready", то загруженных, если "error", то не загруженных из-за ошибки во время загрузки
uploadFile: async (File) => {id, name, url, size, extension} - асихнхронная функция аплоада файла на сервер, должна возвращать новый файл для списка
onChange: (file[]) => void - колбэк, который вызывается при изменении списка файлов
showDownloadControl: Boolean - показывать ли кнопку скачивания файла, по умолчанию true
showRemoveControl: Boolean - показывать ли кнопку удаления файла, по умолчанию true
getControls: ({ file, disabled, showDownloadControl, showRemoveControl, removeFile }) => [{ component, icon, text, componentProps}] - функция, создающая конфигурацию кнопок для управления файлом, перекрывает свойства showRemoveControl и showDownloadControl
isDragAndDrop: Boolean - показывать ли поле для драг-н-дропа, по умолчанию true
import { fileIdPropType, filePropType } from '@n3/react-fileuploader';
fileIdPropType - тип id файлаfilePropType - тип файла из массива filesОшибка, которая должна быть вызвана в случае неудачной загрузки файла в функции uploadFile
import { UploadFileError } from '@n3/react-fileuploader';
const uploadFile = async () {
...
throw new UploadFileError([
'error1',
'error2',
'error3',
]);
}
Подключение стандартных стилей:
import '@n3/react-fileuploader/dist/n3-react-fileuploader.css';
FAQs
File uploader component for react applications
The npm package @n3/react-fileuploader receives a total of 33 weekly downloads. As such, @n3/react-fileuploader popularity was classified as not popular.
We found that @n3/react-fileuploader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.

Security News
OSV withdrew 157 OSV malware reports after automated false positives incorrectly flagged trusted npm and PyPI packages, sending bad records into tools that rely on OSV data.

Research
/Security News
TrapDoor crypto stealer hits 36 malicious packages across npm, PyPI, and Crates.io, targeting crypto, DeFi, AI, and security developers.