Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-files
Advanced tools
A file input (dropzone) management component for React
Install from NPM and include it in your own React build process (using Browserify, Webpack, etc).
npm install react-files --save
import React from 'react'
import ReactDOM from 'react-dom'
import Files from 'react-files'
var FilesDemo = React.createClass({
onFilesChange: function (files) {
console.log(files)
},
onFilesError: function (error, file) {
console.log('error code ' + error.code + ': ' + error.message)
},
render: function() {
return (
<div className="files">
<Files
className='files-dropzone'
onChange={this.onFilesChange}
onError={this.onFilesError}
accepts={['image/png', '.pdf', 'audio/*']}
multiple
maxFileSize={10000000}
minFileSize={0}
clickable
>
Drop files here or click to upload
</Files>
</div>
)
}
})
ReactDOM.render(<FilesDemo />, document.getElementById('container'))
See "Tinker" instructions below to run and view all examples.
git clone https://github.com/mother/react-files
npm install
And since React is just a peer dependency:
npm install react
Then:
npm run demo
Then visit http://localhost:8080/
npm run build
onChange(files)
- Function
Perform work on files added when submit is clicked.
onError(error, file)
- Function
error.code
- Numbererror.message
- StringPerform work or notify the user when an error occurs.
Error codes are:
accepts
- Array of String
Control what types of generic/specific MIME types or file extensions can be dropped/added.
See full list of MIME types here: http://www.iana.org/assignments/media-types/media-types.xhtml
Example:
accepts={['image/*', 'video/mp4', 'audio/*', '.pdf']}
multiple
- Boolean
Default: true
Allow multiple files
clickable
- Boolean
Default: true
Dropzone is clickable to open file browser. Disable for dropping only.
maxFiles
- Number
Default: Infinity
Maximum number of files allowed
maxFileSize
- Number
Default: Infinity
Maximum file size allowed (in bytes)
minFileSize
- Number
Default: 0
Minimum file size allowed (in bytes)
dragActiveClassName
- String
Default: 'files-dropzone-active'
Class added to the Files component when user is actively hovering over the dropzone with files selected.
npm test
MIT. Copyright (c) Mother Co. 2020
FAQs
A file input (dropzone) management component for React
The npm package react-files receives a total of 10,127 weekly downloads. As such, react-files popularity was classified as popular.
We found that react-files demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.