Comments (3)
Gotcha! This must have changed between node 16 and 20 which is why I suddenly ran into it.
I did see that there were two distinct types of stream, but the error thrown by node doesn't indicate the two types, but instead that the arg is a Sharp
which masks the real issue!
Thank you for looking into this :)
Update: Example now works: https://stackblitz.com/edit/sveltejs-kit-template-default-ea5vps?file=src%2Froutes%2F%2Bserver.js
from sharp.
Hi Antony, great to meet you too.
The body
property provided by fetch()
is a ReadableStream
, which is somewhat confusingly part of the Web API rather than the Node.js Stream API. You can convert it to a Readable
(i.e. a Node.js Stream) using Readable.fromWeb().
- const resizedImage = imageRes.body.pipeTo(transformer);
+ const resizedImage = Readable.fromWeb(imageRes.body).pipe(transformer);
I'll add an example to the docs as I suspect you won't be the only person who runs into this.
from sharp.
Commit 045d54e modernises one of the existing examples in the docs to include use of fetch()
and .fromWeb()
.
from sharp.
Related Issues (20)
- Sharp not compressing image with resolution HOT 3
- NodeJS Sharp - Change the color of an image while retaining the transparency of the background HOT 4
- No loader is configured for ".node" files: node_modules/sharp/build/Release/sharp-darwin-arm64v8.node HOT 5
- Usage of minSize in webp HOT 2
- Enhancement: add support for jpegli as jpeg encoder HOT 3
- Animated gif resizing discards per-frame background and transparency data HOT 1
- Can I use latest version sharp in Nodejs version 14.19.3 ? HOT 1
- Completely broken in latest version of debian HOT 1
- removing animation while uploading to s3 using sharp HOT 5
- Are there technical and/or licensing issues that require libvips to be shipped as separate library? HOT 2
- Is there another operation than composite to apply a highlighted rectangle to an image? HOT 2
- EPERM problem
- sharp is not compatible with the Node :- 17.9.1 NPM :- 8.11.0 HOT 2
- When you use sharp to convert svg to png, something is missing! HOT 2
- Using `clone` and `joinChannel` together apply channel operation to all output HOT 2
- Override HEIC output limitation HOT 1
- Support outputting higher bit-depth AVIF HOT 1
- Which is better between Sharp.metadata() vs fs.stat() to get image size HOT 1
- Keep only specified EXIF, IPTC, and XMP metadata tag values (similar to `withExifMerge`) HOT 2
- default `limitInputPixels` is not set correctly for jpeg input, avif output, yields `Error: Input image exceeds pixel limit` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharp.