react-relay-upload-s3
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

React Relay Upload S3

Middleware for Relay Modern Network Layer for upload file to AWS S3

Installation

Install react-relay-upload-s3 using yarn or npm:

yarn add react-relay-upload-s3

Usage

How to create the RelayNetworkLayer

import {uploadS3Middleware} from 'react-relay-upload-s3';
const network = new RelayNetworkLayer(
  [
    urlMiddleware(...),
    uploadS3Middleware({credentials: complexObjectsCredentials}),
    authMiddleware(...),
  ],
  {}
);

How to use in commitMutation

 
    //single file
    const file:any = {
      bucket: bucket,
      key: key,
      region: region,
      file: selectedFile
    };
 
    commitMutation(
        ...
        uploadables{
          file 
        },
    );
 
    //multiple files
    const file1:any = {
      bucket: bucket,
      key: key1,
      region: region,
      file: selectedFile1
    };
 
    const file2:any = {
      bucket: bucket,
      key: key2,
      region: region,
      file: selectedFile2
    };
 
    commitMutation(
        ...
        uploadables{
          file1,
          file2 
        },
    );

TODO

Document how to use urlMiddleware and authMiddleware in the context of AWS

License

React Relay Upload S3 is MIT licensed.

Package Sidebar

Install

npm i react-relay-upload-s3

Weekly Downloads

4

Version

0.0.2

License

SEE LICENSE IN LICENSE

Unpacked Size

8.63 kB

Total Files

7

Last publish

Collaborators

  • morrys