-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: support info.size on wide-character systems (a.k.a. the C++17 upgrade) #3943
Comments
Thanks for reporting, this appears to be due to the way that Windows exposes filesystem data to C code. Here's the logic in sharp that reads the size of the output file: Line 1295 in 0dcc7d5
For Windows, the Line 25 in 0dcc7d5
For "wide-character" paths the docs suggest using https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions I think the best thing to do here is upgrade to using C++17 and take advantage of its new |
toFile
method contains non-ASCII characters, info.size
will become undefined
I had a quick look at what might be required for this. https://github.com/lovell/sharp/compare/upgrade-to-c++17
In summary and on balance, the risks from upgrading currently outweigh the benefits it might bring. |
Having revisited this, it looks like Windows was crashing when trying to (recursively? concurrently?) calculate the size of a directory, so I've updated the logic to prevent that happening - see bbe60cd |
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.node -e "require('sharp')"
completes without error.If you cannot confirm both of these, please open an installation issue instead.
Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of
sharp
that is not the latest, please open an issue against that package instead.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?What are the steps to reproduce?
For any input image processed by the Sharp library using the
toFile
operation, when the output path contains non-ASCII characters, theinfo.size
of thetoFile
operation will become undefined instead of being a numeric value.What is the expected behaviour?
The
info.size
of thetoFile
function should be a numeric value.Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
It runs well when using path1, but when using path2,
info.size
becomes undefined.Please provide sample image(s) that help explain this problem
The text was updated successfully, but these errors were encountered: