1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/strip-bom
詹力 1a19ec897f 删除无关模块 2024-01-16 21:26:16 +08:00
..
cli.js i4 2023-12-18 13:12:25 +08:00
index.js i4 2023-12-18 13:12:25 +08:00
package.json 删除无关模块 2024-01-16 21:26:16 +08:00
readme.md i4 2023-12-18 13:12:25 +08:00

readme.md

strip-bom Build Status

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

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.

Usage

$ npm install --save strip-bom
var fs = require('fs');
var stripBom = require('strip-bom');

stripBom('\ufeffUnicorn');
//=> Unicorn

stripBom(fs.readFileSync('unicorn.txt'));
//=> Unicorn

Or as a Transform stream:

var fs = require('fs');
var stripBom = require('strip-bom');

fs.createReadStream('unicorn.txt')
	.pipe(stripBom.stream())
	.pipe(fs.createWriteStream('unicorn.txt'));

CLI

$ npm install --global strip-bom
$ strip-bom --help

  Usage
    strip-bom <file> > <new-file>
    cat <file> | strip-bom > <new-file>

  Example
    strip-bom unicorn.txt > unicorn-without-bom.txt

License

MIT © Sindre Sorhus