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

138
Vistas
Javascript AWS S3.upload gives a promise?

The AWS instructions on S3 uploading (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3/ManagedUpload.html) would suggest that the following should work.

var managed = s3.upload(params, function(err, data) {
    if (err) {
        throw err;
    }
    console.log(`File uploaded successfully. ${data.Location}`);
});
p = managed.promise();
console.log(p);

s3.upload returns a ManagedUpload object, and this seems to be working. Supposedly the object has a promise() method that returns a promise that could be used with the .then programming style. However, when I actually try I'm getting

Uncaught TypeError TypeError: managed.promise is not a function

Is this documentation out of date? Is there a better one somewhere?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

From the docs in upload() just enter the parameters, then() method should be called on the promise object to handle a result (resolve) or an error (reject).

var upload = s3.upload({Bucket: 'bucket', Key: 'key', Body: stream});
var promise = upload.promise();
promise.then(function(data) { ... }, function(err) { ... });
about 4 years ago · Juan Pablo Isaza Denunciar
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