JavaScript function to strip the Byte Order Mark from a file.
/**
* Strip Byte Order Mark (BOM)
*
* @param {Buffer|String} content
* @return {String}
*/
function stripBom(content) {
// we do this because JSON.parse would convert it to a utf8 string
// if encoding wasn't specified
if (Buffer.isBuffer(content)) {
content = content.toString("utf8");
}
content = content.replace(/^\uFEFF/, "");
return content;
}