Socket
Socket
Sign inDemoInstall

react-s3-uploader

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-s3-uploader - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

2

package.json
{
"name": "react-s3-uploader",
"version": "1.1.5",
"version": "1.1.6",
"description": "React component that renders a file input and automatically uploads to an S3 bucket",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -39,3 +39,3 @@ react-s3-uploader

-----------
### Bundled router
You can use the Express router that is bundled with this module to answer calls to `/s3/sign`

@@ -54,1 +54,23 @@

The `aws-sdk` must be configured with your account's Access Key and Secret Access Key. [There are a number of ways to provide these](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html), but setting up environment variables is the quickest. You just have to configure environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`, and AWS automatically picks them up.
### Boto for Python, in a Django project
import boto
import mimetypes
import json
...
conn = boto.connect_s3('AWS_KEY', 'AWS_SECRET')
def sign_s3_upload(request):
object_name = request.GET['objectName']
content_type = mimetypes.guess_type(object_name)[0]
signed_url = conn.generate_url(
300,
"PUT",
'BUCKET_NAME',
'FOLDER_NAME' + object_name,
headers = {'Content-Type': content_type, 'x-amz-acl':'public-read'})
return HttpResponse(json.dumps({'signedUrl': signed_url}))

@@ -62,3 +62,4 @@ /**

var xhr = new XMLHttpRequest();
xhr.open('GET', this.signingUrl + '?objectName=' + file.name, true);
var fileName = file.name.replace(/[^\w]/g, "_");
xhr.open('GET', this.signingUrl + '?objectName=' + fileName, true);
xhr.overrideMimeType && xhr.overrideMimeType('text/plain; charset=x-user-defined');

@@ -65,0 +66,0 @@ xhr.onreadystatechange = function() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc