1.0.0 • Published 1 year ago

better-strip-bom v1.0.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
1 year ago

Better Strip BOM

node-current npm semantic-release Release

Code Climate maintainability Scrutinizer coverage (GitHub/BitBucket)

Strip UTF-8 byte order mark (BOM) from a string

From Wikipedia:

The Unicode Standard permits the BOM in UTF-8, but does not require nor recommend its use. Byte order has no meaning in UTF-8.

Install

$ npm install better-strip-bom

Usage

For strings

import { stripBom } from 'better-strip-bom';

stripBom('\uFEFFMagic Man, Magic Hands');
//=> 'Magic Man, Magic Hands'

For Buffers

import { stripBom } from 'better-strip-bom';
import { readFileSync } from 'fs';

stripBom(readFileSync('magic.txt'));
//=> 'Magic Man, Magic Hands'
1.0.0

1 year ago