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

Vinyl-fs src corrupts image files #351

Open
vkorytska opened this issue Apr 25, 2024 · 2 comments
Open

Vinyl-fs src corrupts image files #351

vkorytska opened this issue Apr 25, 2024 · 2 comments

Comments

@vkorytska
Copy link

While the issue is reproduced for Gulp.src, not for Vinyl.src, but this is relevant because Gulp.src uses Vinyl.src.

What were you expecting to happen?

The task should copy images without issue.

What actually happened?

The task corrupted the images. Similar corruption does not occur for text-based files. '{ removeBOM: false, buffer: false, encoding: false }' arguments do not fix the issue.

Please give us a sample of your gulpfile

I created a (public) repository to show the issue with src and images: https://github.com/vkorytska/gulp-src-issue.

Terminal output / screenshots

Added examples of corrupted images to the repository.

Please provide the following information:

  • OS & version [e.g. MacOS Catalina 10.15.4]: Windows 10 22H2
  • node version (run node -v): v21.7.3
  • npm version (run npm -v): 10.5.2
  • gulp version (run gulp -v): 5.0.0

Additional information

This issue is probably similar to aws/aws-sdk-js#1628. In the repository added a quick fix of replacing fs.createReadStream with fs.readFile and the images were copied properly.

I am not sure why specifically image files are corrupted by createReadStream, and not text files.

@tommyZZM
Copy link

tommyZZM commented Jun 9, 2024

👍🏽 yes same issue occur to me

@pavelhoral
Copy link

pavelhoral commented Jun 14, 2024

I was able to recreate the issue when gulp.src had the same options as in the original post ({ removeBOM: false, buffer: false, encoding: false }). However the issue can not be reproduced with the following options { encoding: false }.

Having removeBOM does not make sense for encoding: false. But the issue is present when buffer: false (so some sort of bug is present there).

UPDATE: I already see the PR that addresses this... so there is no need for additional analysis.

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

No branches or pull requests

3 participants