Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
Upload Video To S3 With React Native

I am trying to upload video that was just created to S3 from React Native and am having some difficulties combining react-native-aws3 and react-native-fetch-blob.

There are several answers about uploading images, which works fine when I tweak the code a bit. I am confused both about how to properly pass the blob without a file path (data.uri or data.path will point to the original file which won't be uploaded properly) and about whether the options are correct.

const options = {
    keyPrefix: 'video/',
    bucket: 'XXXX',
    region: 'XXXXX',
    accessKey: 'XXXXX',
    secretKey: 'XXXX',
    successActionStatus: 201
};

uploadImage(data.path) //I call this once the video is done recording.

const uploadImage = (uri, mime = 'application/octet-stream') => {
    return new Promise((resolve, reject) => {
        const uploadUri = Platform.OS === 'ios' ? uri.replace('file://', '') : uri
        const sessionId = new Date().getTime();
        let uploadBlob = null;
        fs.readFile(uploadUri, 'base64')
            .then((blob) => {
                uploadBlob = blob;
                let file = {
                    uri: ???, //a bit confused here.
                    name: "video",
                    type: mime
                }
                RNS3.put(file, options)
                    .then(response => {
                        if(response.status !== 201) {
                            console.log(response.body);
                        }
                        console.log(response);
                    })
                    .catch(err => console.error(err));
            })
    })
}

Several other answers mentioned using FormData.I don't see how I would add that using these libraries.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda