Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9245183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:12:31+00:00 2026-06-18T09:12:31+00:00

I am node and programming in general, and I have been really struggling with

  • 0

I am node and programming in general, and I have been really struggling with this…

I want to take a https response, resize it with graphicsmagick and send it to my amazon S3 bucket.

It appears that the https res is an IncomingMessage object (I can’t find any info about that) and the stdout from graphicsmagick is a Socket.

The weird thing is that I can use pipe and send both of these to a writeStream with a local path, and both res and stdout create a nice new resized image.

And I can even send res to the S3 (using knox) and it works.

But stdout doesn’t want to go to the S3 :-/

Any help would be appreciated!

https.get(JSON.parse(queryResponse).data.url,function(res){

    var headers = {
        'Content-Length': res.headers['content-length']
        , 'Content-Type': res.headers['content-type']
    }

    graphicsmagick(res)
      .resize('50','50')
      .stream(function (err, stdout, stderr) {

        req = S3Client.putStream(stdout,'new_resized.jpg', headers, function(err, res){
        })
        req.end()
    })

})

knox – for connecting to S3 – https://github.com/LearnBoost/knox
graphicsmagick – for image manipulation – https://github.com/aheckmann/gm

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:12:32+00:00Added an answer on June 18, 2026 at 9:12 am

    The problem was with the fact that Amazon needs to know content length before hand (thanks DarkGlass)

    However, since my images are relatively small I found buffering preferential to MultiPartUpload.

    My solution:

    https.get(JSON.parse(queryResponse).data.url,function(res){
    
        graphicsmagick(res)
          .resize('50','50')
          .stream(function (err, stdout, stderr) {
    
            ws. = fs.createWriteStream(output)
    
            i = []
    
            stdout.on('data',function(data){
              i.push(data)
            })
    
            stdout.on('close',function(){
              var image = Buffer.concat(i)
    
              var req = S3Client.put("new-file-name",{
                 'Content-Length' : image.length
                ,'Content-Type' : res.headers['content-type']
              })
    
              req.on('response',function(res){  //prepare 'response' callback from S3
                if (200 == res.statusCode)
                  console.log('it worked')
              })
              req.end(image)  //send the content of the file and an end
            })
        })
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this question for my programming class which I have been struggling to
This is a general programming question (it doesn't have a specific purpose/application yet). If
I'm new to Node.js and asynchronous programming in general, and I have a problem.
First day at programming in Node today. I've been getting along nicely all day
Is it a bad idea to mix programming languages, for example have a node.js
I'm new in shell programming. 1) I want to start 2 node.js processes from
First - a little bit about my background: I have been programming for some
I'm taking my first steps in python programming, I have a class named node
I have learnt from this thread garbage collection with node.js that node.js uses a
I've been working with node.js for a while on a chat app (I know,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.