UNPKG

static-fs

Version:

A static filesystem to bundle files and read them using Node.js

17 lines (14 loc) 452 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stripBOM = stripBOM; exports.strToEncoding = strToEncoding; function stripBOM(content) { return content && content.charCodeAt(0) === 0xfeff ? content.slice(1) : content; } function strToEncoding(str, encoding = 'utf8') { if (encoding === 'utf8') return str; if (encoding === 'buffer') return new Buffer(str); return Buffer.from(str).toString(encoding); }