@n3okill/utils
Version:
Many javascript helpers
11 lines • 370 B
JavaScript
/* global BufferEncoding */
/**
* Detects buffer enconding
* This is basic helper that will only detect buffer encoding between `utf8` and `utf16le`
* @param arg the buffer to detect encoding
* @returns detected encoding
*/
export function detectEncoding(arg) {
return arg.lastIndexOf(0) !== -1 ? "utf16le" : "utf8";
}
//# sourceMappingURL=detectEncoding.js.map