https://github.com/gulpjs/remove-bom-stream
Remove a UTF8 BOM at the start of the stream.
https://github.com/gulpjs/remove-bom-stream
Last synced: 8 months ago
JSON representation
Remove a UTF8 BOM at the start of the stream.
- Host: GitHub
- URL: https://github.com/gulpjs/remove-bom-stream
- Owner: gulpjs
- License: mit
- Created: 2017-06-16T21:50:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-06T00:41:33.000Z (about 3 years ago)
- Last Synced: 2025-10-04T23:36:49.786Z (9 months ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 7
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# remove-bom-stream
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
Remove a UTF8 BOM at the start of the stream.
## Usage
```js
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
[downloads-image]: https://img.shields.io/npm/dm/remove-bom-stream.svg?style=flat-square
[npm-url]: https://npmjs.com/package/remove-bom-stream
[npm-image]: https://img.shields.io/npm/v/remove-bom-stream.svg?style=flat-square
[ci-url]: https://github.com/gulpjs/remove-bom-stream/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/remove-bom-stream/dev.yml?branch=master&style=flat-square
[coveralls-url]: https://coveralls.io/r/gulpjs/remove-bom-stream
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/remove-bom-stream/master.svg?style=flat-square