Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

remove-bom-stream

gulpjs3.7mMIT2.0.0

Remove a UTF8 BOM at the start of the stream.

bom, remove, utf8, streaming, 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

changelog

Changelog

2.0.0 (2022-04-19)

⚠ BREAKING CHANGES

  • Switch to streamx for streams (#10)
  • Require encoding option to avoid inspecting chunks for UTF-8 encoding (#8)
  • Normalize repository, dropping node <10.13 support (#3)

Features

  • Remove the dependency on remove-bom-buffer (2107f34)
  • Require encoding option to avoid inspecting chunks for UTF-8 encoding (#8) (2107f34)
  • Switch to streamx for streams (#10) (9867811)
  • Use node core's TextDecoder to process beginning of stream (2107f34)

Bug Fixes

  • Handle first chunk shorter than 7 bytes correctly when next chunks are larger (#7) (564f87b)

Miscellaneous Chores

  • Normalize repository, dropping node <10.13 support (#3) (8fece9c)