Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda