| 1 |
# strip-bom-stream [](https://travis-ci.org/sindresorhus/strip-bom-stream) |
| 2 |
|
| 3 |
> Strip UTF-8 [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a stream |
| 4 |
|
| 5 |
From Wikipedia: |
| 6 |
|
| 7 |
> 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. |
| 8 |
|
| 9 |
|
| 10 |
## Install |
| 11 |
|
| 12 |
``` |
| 13 |
$ npm install strip-bom-stream |
| 14 |
``` |
| 15 |
|
| 16 |
|
| 17 |
## Usage |
| 18 |
|
| 19 |
```js |
| 20 |
const fs = require('fs'); |
| 21 |
const stripBomStream = require('strip-bom-stream'); |
| 22 |
|
| 23 |
fs.createReadStream('unicorn.txt') |
| 24 |
.pipe(stripBomStream()) |
| 25 |
.pipe(fs.createWriteStream('unicorn.txt')); |
| 26 |
``` |
| 27 |
|
| 28 |
It's a [`Transform` stream](https://nodejs.org/api/stream.html#stream_class_stream_transform). |
| 29 |
|
| 30 |
|
| 31 |
## Related |
| 32 |
|
| 33 |
- [strip-bom](https://github.com/sindresorhus/strip-bom) - String version of this module |
| 34 |
- [strip-bom-buf](https://github.com/sindresorhus/strip-bom-buf) - Buffer version of this module |
| 35 |
|
| 36 |
|
| 37 |
## License |
| 38 |
|
| 39 |
MIT © [Sindre Sorhus](https://sindresorhus.com) |