How to get remote image size before download

I would like to be able to check image size before download.
I am trying the HTTP Request node with Method HEAD but some remote servers do not return image size.
Is there other way?
Thanks

This is not really a Node-RED question, but have you tried a google search using “get image size before downloading” to see if others have a solution?

Sorry, my description of the problem was somewhat cryptic...

I am using a node from node-red-contrib-image-tools that accepts URLs and images and outputs images that latter I use for analysis.
Users submit URLs that are converted to images by the node mentioned above.
I would like to limit the size of the images summited to the image node that actually downloads the image and pass it to the next node.

In the representation above function node would check image size,
If it is too large it would generate an http response (too large)
If image within size requirements it would let the flow continue

If the remote server doesn't respond properly to the HEAD request, then there's not much you can do other than GET the whole image and then decided what to do with it.

Hi, I was anticipating this bad news...
Thanks for the clarification.
Paulo

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.