feat: add experimental unflatten handler for image processing
This pull request introduces a new handler function to the src/handlers/handlers.ts file. The new function, unflatten, is experimental and its API may change in the future.
New handler function added:
src/handlers/handlers.ts: Added theunflattenhandler, which calls theunflattenmethod on the providedpipe. This feature is marked as experimental.
See https://sharp.pixelplumbing.com/api-operation#unflatten for more information.
Thanks for PR dear @nathanchase. Wondering is it worth to wait for sharp feature to be stable first?
Do you have some more context why it is in experimental state?
Codecov Report
Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
Project coverage is 56.18%. Comparing base (
f666cb4) to head (7dd635f). Report is 20 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/handlers/handlers.ts | 77.77% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #248 +/- ##
==========================================
+ Coverage 56.02% 56.18% +0.16%
==========================================
Files 14 14
Lines 1203 1212 +9
Branches 83 84 +1
==========================================
+ Hits 674 681 +7
- Misses 526 528 +2
Partials 3 3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚨 Try these New Features:
- Flaky Tests Detection - Detect and resolve failed and flaky tests
- JS Bundle Analysis - Avoid shipping oversized bundles
Thanks for PR dear @nathanchase. Wondering is it worth to wait for sharp feature to be stable first?
Do you have some more context why it is in experimental state?
I don't have any knowledge of why it's experimental. I just know that I have an immediate use case for it with https://github.com/nuxt/image to make all images with a solid white background become transparent backgrounds. I happened to notice it wasn't wired up to sharp's implementation, so this was just meant as a means of connecting to the unflatten functionality that already exists so that I could use it.
For what it's worth, unflatten has been in sharp since April 2023.
https://github.com/lovell/sharp/issues/1648#issuecomment-1525238474