benjreinhart / react-native-aws3

Pure JavaScript React Native library for uploading to AWS S3
MIT License
399 stars 151 forks source link

Uploading Audio caf files to aws3 #45

Open ahmdsdk opened 7 years ago

ahmdsdk commented 7 years ago

Is it possible to upload audio caf files? I've been trying to do that but the uploaded file ends up being 0 bytes..that's the code:

    let file = {
      uri: this.recording.uri,
      name: "sound-test.caf",
      type: "audio/caf",
    }
    let options = {
      keyPrefix: "uploads/" + "admin" + "/tests/",
      bucket: "xxxx-xxxx",
      region: "us-west-1",
      accessKey: "XXXXXX",
      secretKey: "XXXXXX",
      successActionStatus: 201,
    }

    RNS3.put(file, options).then(response => {
      console.log(response.status);
      if (response.status !== 201) {
        throw new Error("failed to upload audio to s3");
      }
      console.log(response.body);
      console.log(response.body.postResponse.location);
    });
pjammer commented 6 years ago

Did you ever resolve this issue?