mirror of
https://github.com/nasa/openmct.git
synced 2025-06-07 01:41:40 +00:00
Modified file copy prcess to prevent encoding of png's as utf8
This commit is contained in:
parent
5b617295e9
commit
8c2a29e895
@ -179,13 +179,17 @@ GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be define
|
|||||||
glob(options['in'] + "/**/*.@(html|css|png)", {}, function (err, files) {
|
glob(options['in'] + "/**/*.@(html|css|png)", {}, function (err, files) {
|
||||||
files.forEach(function (file) {
|
files.forEach(function (file) {
|
||||||
var destination = file.replace(options['in'], options.out),
|
var destination = file.replace(options['in'], options.out),
|
||||||
destPath = path.dirname(destination);
|
destPath = path.dirname(destination),
|
||||||
|
streamOptions = {};
|
||||||
|
if (file.match(/png$/)){
|
||||||
|
streamOptions.encoding = 'binary';
|
||||||
|
} else {
|
||||||
|
streamOptions.encoding = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
mkdirp(destPath, function (err) {
|
mkdirp(destPath, function (err) {
|
||||||
fs.createReadStream(file, { encoding: 'utf8' })
|
fs.createReadStream(file, streamOptions)
|
||||||
.pipe(fs.createWriteStream(destination, {
|
.pipe(fs.createWriteStream(destination, streamOptions));
|
||||||
encoding: 'utf8'
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user