-
-
Save vendethiel/2954951 to your computer and use it in GitHub Desktop.
Removing BOM
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
global[r] = require r for r of <[js path wrench]> | |
BOM = String.fromCharCode BOM_CHAR_CODE = 65279 | |
wrench.readdirSyncRecursive process.cwd! .forEach (filename) -> | |
return unless \js is path.extname filename | |
error, content <-! fs.readFile fileName, \utf8 | |
throw that if error | |
unless content.charCodeAt 0 is BOM_CHAR_CODE | |
fs.writeFile content, BOM + @@1, \utf8 -> throw it if it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment