Skip to content
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

failOnError: false with streams causes Input file is missing error #1691

Closed
timothyallan opened this issue May 8, 2019 · 5 comments
Closed

Comments

@timothyallan
Copy link

What is the output of running npx envinfo --binaries --languages --system --utilities?

System:
    OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (6) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 231.25 MB / 1.95 GB
    Container: Yes
    Shell: 4.4.12 - /bin/bash
  Binaries:
    Node: 11.10.1 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
  Utilities:
    Make: 4.1 - /usr/bin/make
    GCC: 6.3.0 - /usr/bin/gcc
    Git: 2.11.0 - /usr/bin/git
  Languages:
    Bash: 4.4.12 - /bin/bash
    Perl: 5.24.1 - /usr/bin/perl
    Python: 2.7.13 - /usr/bin/python

What are the steps to reproduce?

Using {failOnError : false} constantly gives an Input file is missing error. Remove that option and everything works.

const fileName = __dirname + '/input.jpg';
const saver = sharp({ failOnError: false }).toFile(__dirname + '/output.jpg', function(err) {
  console.log('err', err);
  });
fs.createReadStream(fileName).pipe(saver);

What is the expected behaviour?

See output.jpg created.

Are you able to provide a sample image that helps explain the problem?

Any image seems to work.

@lovell
Copy link
Owner

lovell commented May 8, 2019

I think this is related to #1579 - certain input options have previously (and appear to continue to) prevent sharp accepting Stream-based input.

As a workaround, please can you try sharp(null, { failOnError: false }) to force sharp to expect Stream-based input.

@lovell lovell added the triage label May 8, 2019
@timothyallan
Copy link
Author

Perfect! In order to stop TypeScript from yelling at you, you've got to use sharp(undefined, { failOnError: false }), but the end result is the same.

@lovell
Copy link
Owner

lovell commented Jun 26, 2019

Test and fix in commit 6289968 to be included in v0.23.0. Thanks for reporting this.

@lovell lovell added this to the v0.23.0 milestone Jun 26, 2019
@lovell
Copy link
Owner

lovell commented Jul 29, 2019

sharp v0.23.0 is now available.

@lovell lovell closed this as completed Jul 29, 2019
@mattcwebster

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants