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

Gulp.dest copy corrupts some image files on Windows #1933

Closed
jon-lester opened this issue Mar 24, 2017 · 6 comments
Closed

Gulp.dest copy corrupts some image files on Windows #1933

jon-lester opened this issue Mar 24, 2017 · 6 comments

Comments

@jon-lester
Copy link

What were you expecting to happen?

We're expecting image files to be directly binary-copied to the output directory, but instead some are being corrupted during the copy, resulting in images that won't load into the page.

This happens on Windows 7 and Windows 10, but not on MacOS with the same build script and software versions.

The problem seems inconsistent in which images it corrupts for any given build, however it tends to corrupt those which appear closer to the start of the standard sort-order.

We haven't noticed any issues with text files.

What actually happened?

It appears as though some of the image files are perhaps being parsed as UTF8. What makes us think this is that, for example, the hex value 0xA2 in the source file is being replaced with 0xEF 0xBF 0xBD at the destination (the UTF8 replacement character).

Please see the attachment, containing copies of one of the image files before and after the copy:

corruptimage.zip

Please post a sample of your gulpfile (preferably reduced to just the bit that's not working)

gulp.task( "copy-image", function () {
	// Copy images from "/[source]/assets/images" to "/[build]/assets/images"
	gulp.src([
		"./" + config.dir.source + "/assets/images/**/*"
	]).pipe( gulp.dest("./" + config.dir.build + "/assets/images") );
});

What versions are you using?

Gulp version: 3.9.1 (and the 3.x versions that we've used previously)
Npm version: 3.10.3
Node version: 6.6
Windows version: 7 / 10

@yocontra
Copy link
Member

Does this happen on 4.0 as well?

@phated
Copy link
Member

phated commented Mar 24, 2017

Use the read: false option. That's what it is there for.

@phated phated closed this as completed Mar 24, 2017
@yocontra
Copy link
Member

Yep - use the streaming mode. This should be better documented IMO.

@jon-lester
Copy link
Author

Thanks all - will look into this option.

@phated
Copy link
Member

phated commented Mar 24, 2017

(correction) I believe the option is buffer: false

@JosephTurner

This comment has been minimized.

@gulpjs gulpjs locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants