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

218
Views
Descargar imagen desde una url con nodejs

Necesito escribir un código que tomará una URL de imagen en Facebook y la descargará al servidor con nodejs. Usé un método nativo de nodejs pero no funcionó, porque la URL de la carga útil de Facebook tiene una marca de tiempo al final, mientras que esas herramientas requieren que la URL termine en .jpg o .png.

 Url format:https://external-lcy1-1.xx.fbcdn.net/safe_image.php?w=64&url=https%3A%2F%2Fscontent-lcy1-1.xx.fbcdn.net%2Fv%2Ft45.1600-4%2F287436200_23850867680280670_5673356940532891089_n.jpg%3Fccb%3D1-7%26_nc_eui2%3DAeGxRrXd7pkY2ssWbjED_kJ_IqAoXrLmbjcioChesuZuN49f8D6YNKRvBnR55UjJSvQ%26_nc_ohc%3D3fprzn1El7AAX-4AhdH%26_nc_ht%3Dscontent-lcy1-1.xx%26edm%3DAAT1rw8EAAAA%26oh%3D00_AT9zIeMdo8mCWidjpKIH3ni3rF_QSIcf4kKWI4zn5A8OMg%26oe%3D62D2125C&cfs=1&ext=emg0&_nc_eui2=AeH-hxRM-N8xK8-hZD8Tbxpeo9ckW8MrnL-j1yRbwyucv_yxsSs9DC7ahcZ-3T9cfrI&utld=fbcdn.net&_nc_oe=7070b&_nc_sid=58080a&ccb=3-6&_nc_hash=AQFuBfHWEQYiHZdt

He intentado usar el método nativo y las bibliotecas de nodejs, y ninguno de ellos funciona.

 let fs = require('fs'), request = require('request'); let download = function(uri, filename, callback){ request.head(uri, function(err, res, body){ console.log('content-type:', res.headers['content-type']); console.log('content-length:', res.headers['content-length']); request(uri).pipe(fs.createWriteStream(filename)).on('close', callback); }); }; download('url', './fb_ads_images/post.png', function(){ console.log('done'); });
about 4 years ago · Juan Pablo Isaza
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!