
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
ack-aws-s3-universal
Advanced tools
Library to perform AWS S3 in a universal manner between both NodeJs and Web Browsers, with focus on with optional KmsParams
Library to perform AWS S3 in a universal manner between both NodeJs and Web Browsers with optional KmsParams envelope encryption
A wrapper for aws-sdk, aws-sdk-js, node-s3-encryption-client, and crypto
GOAL: To provide one package that facilitates both the web and node-server enviroment.
npm install ack-aws-s3-universal --save
To GET, PUT, or POST to an S3 bucket from a web browser, Cross Origin Requests must be configured properly.
Enable CORS on your S3 bucket
Use the following universal configuration to allow CORS on your S3 bucket
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
<ExposeHeader>x-amz-request-id</ExposeHeader>
<ExposeHeader>x-amz-id-2</ExposeHeader>
<ExposeHeader>x-amz-meta-x-amz-key</ExposeHeader>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
const ackS3 = require('ack-aws-s3-universal')
const config = {
accessKeyId: ""//fill
,secretAccessKey: ""//fill
}
const bucket = ""//fill
const filename = ""//fill
//ACCESS CONFIG
ackS3.AWS.config.update(config)
ackS3.AWS.config.region = 'us-east-1'
const getData = {
Bucket:bucket,
Key:filename
}
ackS3.promise(getData)
.then(data=>{
console.log(data.Body)
})
.catch(e=>console.error(e))
Use config variables seen in NodeJs GET Example to continue with this example
const putData = {
Bucket:bucket,
Body:"Hello S3 World!",
Key:filename,
KmsParams:{//optional fill for encryption
KeyId:"",//fill
KeySpec:"AES_256"
}
}
ackS3.promisePut(putData)
.then(data=>{
console.log('put success!')
})
.catch(e=>console.error(e))
If you are bundling (webpack/jspm) this code
import ackS3 from "ack-aws-s3-universal"
If you need a script tag:
<script src="dist/ack-aws-s3-universal.js" type="text/javascript"></script>
The following examples are also available for testing here: ./dist/index.html
<script>
//The variable "ackS3" must already be available
//ACCESS CONFIG
ackS3.AWS.config.update({
accessKeyId: ""//fill
,secretAccessKey: ""//fill
})
ackS3.AWS.config.region = 'us-east-1'
var bucket = ""//fill
var filename = ""//fill
//GET CONFIG
var getData = {
Bucket:bucket,
Key:filename
}
function getObject(){
ackS3.get(getData, (err,data)=>{
if(err)return console.log(err)
alert('GET success!!!!')
console.log('GET.BODY', data.Body)
})
}
getObject()
</script>
Use config variables seen in GET Example to continue with this example
<script>
//The variable "ackS3" must already be available
//ackS3 adn ACCESS CONFIG must already be configured. See GET Example
//PUT CONFIG
var putData = {
Bucket:bucket,//configred in GET example
Body:"Hello S3 World!",
Key:filename,//configred in GET example
KmsParams:{//optional fill
KeyId:"",//fill
KeySpec:"AES_256"
}
}
function putObject(){
ackS3.put(putData, (err,data)=>{
if(err)return console.error(err)
alert('PUT success!!!!')
})
}
putObject()
FAQs
Library to perform AWS S3 in a universal manner between both NodeJs and Web Browsers, with focus on with optional KmsParams
The npm package ack-aws-s3-universal receives a total of 1 weekly downloads. As such, ack-aws-s3-universal popularity was classified as not popular.
We found that ack-aws-s3-universal 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
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.