Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@maxsparrow/aws-s3
Advanced tools
S3Client - A Javascript Library for AWS S3 File Upload
npm install --save aws-s3
import S3Client from 'aws-s3';
//Optional Import
import { uploadFile } from 'aws-s3';
const config = {
bucketName: 'myBucket',
dirName: 'photos', /* optional */
region: 'eu-west-1',
accessKeyId: 'ANEIFNENI4324N2NIEXAMPLE',
secretAccessKey: 'cms21uMxçduyUxYjeg20+DEkgDxe6veFosBT7eUgEXAMPLE',
}
/* Notice that if you don't provide a dirName, the file will be automatically uploaded to the root of your bucket */
S3Client
.uploadFile(file, config)
.then(data => console.log(data))
.catch(err => console.error(err))
//** OR *//
uploadFile(file, config)
.then(data => console.log(data))
.catch(err => console.error(err))
/**
* {
* Response: {
* bucket: "your-bucket-name",
* key: "photos/image.jpg",
* location: "https://your-bucket.s3.amazonaws.com/photos/image.jpg"
* }
* }
*/
});
In this case the file that we want to delete is in the folder 'photos'
import S3Client from 'aws-s3';
//Optional Import
import { deleteFile } from 'aws-s3';
const config = {
bucketName: 'myBucket',
dirName: 'school-documents',
region: 'eu-west-1',
accessKeyId: 'ANEIFNENI4324N2NIEXAMPLE',
secretAccessKey: 'cms21uMxçduyUxYjeg20+DEkgDxe6veFosBT7eUgEXAMPLE',
}
const filename = 'hello-world.pdf'
/* 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
S3Client
.deleteFile(filename, config)
.then(response => console.log(response))
.catch(err => console.error(err))
//** OR *//
deleteFile(filename, config)
.then(response => console.log(response))
.catch(err => console.error(err))
/**
* {
* Response: {
* ok: true,
status: 204,
message: 'File deleted',
fileName: 'hello-world.pdf'
* }
* }
*/
});
Doc: http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
{
"Version": "2012-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow all kind of http requests originating from http://www.your-website.com and https://www.your-website.com",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::myBucket/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"https://www.your-website.com",
"http://www.your-website.com"
]
}
}
}
]
}
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
Versions History
Version 1.5.6 - Support for Aws-China - #30 #32
Version 1.5.5 - CRA Bug Fix
Version 1.5.0 - Bug fix & ES5 transpilation
Version 1.4.0 - Renamed Project
Version 1.3.0 - Support for any type of file
Version 1.2.2 - Album bug fix plus async + await
Version 1.2 - Now supports delete method.
Version 1.1 - No more aws-sdk dependecies.
MIT
FAQs
S3Client - A Javascript Library for AWS S3 File Upload
The npm package @maxsparrow/aws-s3 receives a total of 2 weekly downloads. As such, @maxsparrow/aws-s3 popularity was classified as not popular.
We found that @maxsparrow/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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.