Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-aws-s3
Advanced tools
Open Source Module to Upload your Media and files into AWS S3 Bucket directly from Front-end React.
Open Source Module to Upload your Media and files into AWS S3 Bucket directly from Front-end React.
S3Client - A Javascript Library for AWS S3 File Upload
Using NPM
npm install --save react-aws-s3
Using Yarn
yarn add react-aws-s3
import S3 from 'react-aws-s3';
const config = {
bucketName: 'myBucket',
dirName: 'media', /* optional */
region: 'eu-west-1',
accessKeyId: 'JAJHAFJFHJDFJSDHFSDHFJKDSF',
secretAccessKey: 'jhsdf99845fd98qwed42ebdyeqwd-3r98f373f=qwrq3rfr3rf',
s3Url: 'https:/your-custom-s3-url.com/', /* optional */
}
const ReactS3Client = new S3(config);
/* Notice that if you don't provide a dirName, the file will be automatically uploaded to the root of your bucket */
/* This is optional */
const newFileName = 'test-file';
ReactS3Client
.uploadFile(file, newFileName)
.then(data => console.log(data))
.catch(err => console.error(err))
/**
* {
* Response: {
* bucket: "myBucket",
* key: "image/test-image.jpg",
* location: "https://myBucket.s3.amazonaws.com/media/test-file.jpg"
* }
* }
*/
});
In this case the file that we want to delete is in the folder 'photos'
import S3 from 'react-aws-s3';
const config = {
bucketName: 'myBucket',
dirName: 'media', /* optional */
region: 'eu-west-1',
accessKeyId: 'JAJHAFJFHJDFJSDHFSDHFJKDSF',
secretAccessKey: 'jhsdf99845fd98qwed42ebdyeqwd-3r98f373f=qwrq3rfr3rf',
s3Url: 'https:/your-custom-s3-url.com/', /* optional */
}
const ReactS3Client = new S3(config);
const filename = 'hello-world.docx';
/* If the file that you want to delete it's in your bucket's root folder, don't provide any dirName in the config object */
//In this case the file that we want to delete is in the folder 'photos' that we referred in the config object as the dirName
ReactS3Client
.deleteFile(filename)
.then(response => console.log(response))
.catch(err => console.error(err))
/**
* {
* Response: {
* ok: true,
status: 204,
message: 'File deleted',
fileName: 'hello-world.docx'
* }
* }
*/
});
Defaults your bucket to public-read
: http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
config
bucketName
required - Your S3 bucketdirName
required - Your S3 folderName/dirNameregion
required - Your S3 bucket's regionaccessKeyId
required - Your S3 AccessKeyId
secretAccessKey
required - Your S3 SecretAccessKey
s3Url
optional - Your S3 URLDoc: http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
MIT
FAQs
Open Source Module to Upload your Media and files into AWS S3 Bucket directly from Front-end React.
The npm package react-aws-s3 receives a total of 2,337 weekly downloads. As such, react-aws-s3 popularity was classified as popular.
We found that react-aws-s3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.