You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using the streams API (piping to sharp, piping result to a stream) for my current application, but have certain cases where using streams is a bit of a pain.
For instance, I want to check the format when the metadata event is emitted, and if the file is an SVG, I don't want to transform the image at all, but just directly pipe it to the response stream, but since the input stream is already consumed by sharp, I can't get hold of the content anymore.
The alternative would of course be to just buffer the entire input into memory, so I could reuse the Buffer instance. I'm wondering if I would lose any performance doing it this way, though. I've read a couple of issues regarding streams which leads me to believe that at least output streams are not actually.. streaming. Is the same true for input streams?
The text was updated successfully, but these errors were encountered:
The tl;dr is no, but please do read #179 for discussion about adding stream/pipe support to libvips.
You can get away with calling metadata() on an incomplete image Buffer as long as the complete image header is present. See #298 for building this logic into sharp itself.
Hi,
I've been using the streams API (piping to sharp, piping result to a stream) for my current application, but have certain cases where using streams is a bit of a pain.
For instance, I want to check the format when the
metadata
event is emitted, and if the file is an SVG, I don't want to transform the image at all, but just directly pipe it to the response stream, but since the input stream is already consumed by sharp, I can't get hold of the content anymore.The alternative would of course be to just buffer the entire input into memory, so I could reuse the
Buffer
instance. I'm wondering if I would lose any performance doing it this way, though. I've read a couple of issues regarding streams which leads me to believe that at least output streams are not actually.. streaming. Is the same true for input streams?The text was updated successfully, but these errors were encountered: