Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

289
Views
Cargador de imágenes AWS S3 con NodeJS y módulo s3-uploader

Estoy tratando de usar este módulo https://www.npmjs.com/package/s3-uploader pero para mí no está claro cómo implementarlo. ¿Cómo hacer un POST a mi enrutador?

 .post('/upload', ensureAuthenticated, (req, res, next) => { let files = req.files; let client = new Upload(process.env.AWS_BUCKET_NAME, { aws: { path: process.env.AWS_BUCKET_PATH, region: process.env.AWS_BUCKET_REGION, acl: 'public-read' }, cleanup: { versions: true, original: false }, original: { awsImageAcl: 'private' }, versions: [{ maxHeight: 1040, maxWidth: 1040, format: 'jpg', suffix: '-large', quality: 80, awsImageExpires: 31536000, awsImageMaxAge: 31536000 },{ maxWidth: 780, aspect: '3:2!h', suffix: '-medium' },{ maxWidth: 320, aspect: '16:9!h', suffix: '-small' },{ maxHeight: 100, aspect: '1:1', format: 'png', suffix: '-thumb1' },{ maxHeight: 250, maxWidth: 250, aspect: '1:1', suffix: '-thumb2' }] }); client.upload(files.file.path, {}, function(err, versions, meta) { if (err) { throw err; } versions.forEach(function(image) { console.log(image.width, image.height, image.url); // 1024 760 https://my-bucket.s3.amazonaws.com/path/110ec58a-a0f2-4ac4-8393-c866d813b8d1.jpg }); }); }

dentro del .post copié y pegué el código que tienen en el sitio web de NPM y cambié los valores de las variables a los valores míos.

Estoy recibiendo este error:

 Error: Command failed: identify -format "name= size=%[size] format=%m colorspace=%[colorspace] height=%[height] width=%[width] orientation=%[orientation] " /images/logo.png /bin/sh: identify: command not found at ChildProcess.exithandler (child_process.js:206:12) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:877:16) at Socket.<anonymous> (internal/child_process.js:334:11) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at Pipe._handle.close [as _onclose] (net.js:498:12)

Encontré un tema relacionado pero no completamente útil en este hilo: Problema con Node.js S3-uploader

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Aquí está la solución:

Lo único que hice fue instalar imagemagick en mi servidor local.

Tienes que ejecutar esto en tu terminal.

cd $HOME

brew install imagemagick

Cuando termine, puede ejecutar esto para ver la versión y los detalles.

brew info imagemagick

Si no tiene brew , entonces necesita instalarlo.

Gracias

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!