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 have a small convenience library that I use for creating responsive images. It uses through2, with sharp to do the actual conversion. I'm running on node v25.8.1 on MacOS X.
This runs without problems under gulp 4.0.2. However, if I switch to gulp 5.0.1, calling sharp on file.contents (where file is a Vinyl stream) fails with sharp reporting "Input buffer contains unsupported image format".
I dumped out the contents of the buffer, and it is indeed not a valid image. The JPEG header had been trashed, and the rest of the file partly overwritten with garbage data. The file had also bloated to almost twice its previous size.
The problem is definitely caused by the migration from gulp 4.x to 5.x; that's the only difference between the version that works and the one that doesn't.
I suspect that if gulp 5.x were routinely mangling Vinyl streams then someone would probably have said something by now, so it must be that something about my code that was safe to do under 4.x is no longer possible under 5.x. Can anyone suggest what might have happened, and how I can fix this to work with 5.x? Thanks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a small convenience library that I use for creating responsive images. It uses
through2, withsharpto do the actual conversion. I'm running onnodev25.8.1 on MacOS X.This runs without problems under
gulp4.0.2. However, if I switch togulp5.0.1, callingsharponfile.contents(wherefileis a Vinyl stream) fails withsharpreporting "Input buffer contains unsupported image format".I dumped out the contents of the buffer, and it is indeed not a valid image. The JPEG header had been trashed, and the rest of the file partly overwritten with garbage data. The file had also bloated to almost twice its previous size.
The problem is definitely caused by the migration from
gulp4.x to 5.x; that's the only difference between the version that works and the one that doesn't.I suspect that if
gulp5.x were routinely mangling Vinyl streams then someone would probably have said something by now, so it must be that something about my code that was safe to do under 4.x is no longer possible under 5.x. Can anyone suggest what might have happened, and how I can fix this to work with 5.x? Thanks.Beta Was this translation helpful? Give feedback.
All reactions