remove-bom-stream

Remove a UTF8 BOM at the start of the stream.

MIT 4 个版本
安装
npm install remove-bom-stream
yarn add remove-bom-stream
pnpm add remove-bom-stream
bun add remove-bom-stream
README

remove-bom-stream

NPM version Downloads Build Status Coveralls Status

Remove a UTF8 BOM at the start of the stream.

Usage

var fs = require('fs');
var concat = require('concat-stream');
var removeBOM = require('remove-bom-stream');

fs.createReadStream('utf8-file-with-bom.txt')
  .pipe(removeBOM('utf-8'))
  .pipe(
    concat(function (result) {
      // result won't have a BOM
    })
  );

API

removeBOM(encoding)

Returns a Transform stream that will remove a BOM, if the argument encoding is 'utf-8' and the given data is a UTF8 Buffer with a BOM at the beginning. If the encoding is not 'utf-8' or does not have a BOM, the data is not changed and this becomes a no-op Transform stream.

License

MIT

版本列表
2.0.0 2022-04-19
1.2.0 2017-07-05
1.1.0 2017-06-17
1.0.0 2017-06-16