Created
October 13, 2016 15:42
-
-
Save japboy/4ec74686d46d2a99132ae38ecedf4bc3 to your computer and use it in GitHub Desktop.
Revisions
-
japboy created this gist
Oct 13, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ /** * 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); });