<commit_before># react-s3-upload

This library allows you to very easily upload files from a react application to Amazon S3, using express for authing with S3 and signing.

The component is completely stateless, so while it functions as a React component, there's no dependency on the React framework for this package.

Actually, this package has no hard dependencies - it does, however, assume you have aws-sdk configured on your express server.

Library was created following the tutorial available on Heroku - https://devcenter.heroku.com/articles/s3-upload-node

  - Embed the react component in your application
  - Set up your express server
  - Magic

# Installation

    $ npm install react-s3-upload

# React Component

    import ReactUpload from 'react-s3-upload';

    <ReactUpload 
      onProgress={ (pct) => { console.log(pct) } }
      onComplete={ (url) => { console.log(url) } } />

  - `onProgress` - callback function for XHR onprogress.
  - `onComplete` - callback function when upload is done.

# Server-Side

     app.get('/sign_s3', require('react-s3-upload/S3Sign')({
        S3_BUCKET:'your_bucket', 
        unique: false
      }));

  - `unique` - generate a unique filename for your upload or not.
  - `S3_BUCKET` - the name of your Amazon S3 bucket.<commit_msg>updated readme for folder functionality<commit_after># react-s3-upload

This library allows you to very easily upload files from a react application to Amazon S3, using express for authing with S3 and signing.

The component is completely stateless, so while it functions as a React component, there's no dependency on the React framework for this package.

Actually, this package has no hard dependencies - it does, however, assume you have aws-sdk configured on your express server.

Library was created following the tutorial available on Heroku - https://devcenter.heroku.com/articles/s3-upload-node

  - Embed the react component in your application
  - Set up your express server
  - Magic

# Installation

    $ npm install react-s3-upload

# React Component

    import ReactUpload from 'react-s3-upload';

    <ReactUpload 
      onProgress={ (pct) => { console.log(pct) } }
      onComplete={ (url) => { console.log(url) } }
      folder="uploads" />

  - `onProgress` - callback function for XHR onprogress.
  - `onComplete` - callback function when upload is done.
  - `folder` - [optional] folder in your bucket where the file will be uploaded to.

# Server-Side

     app.get('/sign_s3', require('react-s3-upload/S3Sign')({
        S3_BUCKET:'your_bucket', 
        unique: false
      }));

  - `unique` - [optional] generate a unique filename for your upload or not.
  - `S3_BUCKET` - the name of your Amazon S3 bucket.
{'fraction_non_alphanumeric': 0.0880410858400587, 'fraction_numerical': 0.00880410858400587, 'mean_word_length': 3.3632, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '996915', 'n_tokens_mistral': 776, 'n_tokens_neox': 759, 'n_words': 308}