remove-bom-stream

Remove a UTF8 BOM at the start of the stream.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
remove-bom-stream
2.0.04 months ago5 years agoMinified + gzip package size for remove-bom-stream in KB

Readme

<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">

remove-bom-stream
!NPM versionnpm-imagenpm-url !Downloadsdownloads-imagenpm-url !Build Statusci-imageci-url !Coveralls Statuscoveralls-imagecoveralls-url
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