Created
October 13, 2016 15:42
-
-
Save japboy/4ec74686d46d2a99132ae38ecedf4bc3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* UTF-8 から SJIS に一括変換するスクリプト | |
*/ | |
const fs = require('fs'); | |
const glob = require('glob'); | |
const iconv = require('iconv'); | |
const pattern = './assets/**/*'; | |
const files = glob.sync(pattern).filter((file) => fs.statSync(file).isFile()); | |
files.forEach((file) => { | |
const conv = new iconv.Iconv('UTF-8', 'SHIFT_JIS'); | |
const filein = fs.createReadStream(file); | |
const fileout = fs.createWriteStream(file); | |
filein | |
.pipe(conv) | |
.pipe(fileout); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment