1.1.2 • Published 10 years ago

react-s3bucket-upload v1.1.2

Weekly downloads
1
License
ISC
Repository
-
Last release
10 years ago

react-s3bucket-upload

A react function for uploading images to amazon s3 bucket

Deps

##Usage

import uploadImage from "react-s3bucket-upload";

await uploadImage(this,
        `/api/images`, 
        imageFile,
        this.onReceiveDefaultUrls,
        this.onFailImageLoading
      );

###Parameters The first parameter `(/api/images)`- This is an endpoint which signs the request to s3, It's an endpoint on your end to return such things as signature, policy, bucket....etc

  const {
    signature,
    policy,
    date,
    bucket,
    accessKeyID,
    region,
    urls
  } = (await axios.get(`http://localhost:7000/api/images/${uiqueUUID}/signature?type=${type}`)).data;
  where uiqueUUID is a unique uuid generated from this module

imageFile - This is an object of the image selected, which contains, files name, datetime....

onReceiveDefaultUrls(function) - This returns the urls to the images uploaded to s3 bucket amazon

For example
 onReceiveDefaultUrls(formats) {
    //set whatever state once urls are returned.
 }

onFailImageLoading(function) - If an error occures, it recives the error message and sends it back

For example
  onFailImageLoading(error) {
    //display error message
  }
1.1.2

10 years ago

1.1.1

10 years ago

1.0.18

10 years ago

1.0.17

10 years ago

1.0.16

10 years ago

1.0.15

10 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago