pax_global_header 0000666 0000000 0000000 00000000064 13466033316 0014517 g ustar 00root root 0000000 0000000 52 comment=8bf097a24ff281e970181810c27be4493e7edaf8
strip-bom-stream-4.0.0/ 0000775 0000000 0000000 00000000000 13466033316 0014725 5 ustar 00root root 0000000 0000000 strip-bom-stream-4.0.0/.editorconfig 0000664 0000000 0000000 00000000257 13466033316 0017406 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2
strip-bom-stream-4.0.0/.gitattributes 0000664 0000000 0000000 00000000023 13466033316 0017613 0 ustar 00root root 0000000 0000000 * text=auto eol=lf
strip-bom-stream-4.0.0/.gitignore 0000664 0000000 0000000 00000000027 13466033316 0016714 0 ustar 00root root 0000000 0000000 node_modules
yarn.lock
strip-bom-stream-4.0.0/.npmrc 0000664 0000000 0000000 00000000023 13466033316 0016040 0 ustar 00root root 0000000 0000000 package-lock=false
strip-bom-stream-4.0.0/.travis.yml 0000664 0000000 0000000 00000000065 13466033316 0017037 0 ustar 00root root 0000000 0000000 language: node_js
node_js:
- '12'
- '10'
- '8'
strip-bom-stream-4.0.0/fixture 0000664 0000000 0000000 00000000013 13466033316 0016330 0 ustar 00root root 0000000 0000000 Unicorn
strip-bom-stream-4.0.0/index.d.ts 0000664 0000000 0000000 00000001037 13466033316 0016627 0 ustar 00root root 0000000 0000000 import FirstChunkStream = require('first-chunk-stream');
declare namespace stripBomStream {
type StripBomStream = FirstChunkStream;
}
/**
Strip UTF-8 [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a stream.
@example
```
import * as fs from 'fs';
import stripBomStream = require('strip-bom-stream');
fs.createReadStream('unicorn.txt')
.pipe(stripBomStream())
.pipe(fs.createWriteStream('unicorn.txt'));
```
*/
declare function stripBomStream(): stripBomStream.StripBomStream;
export = stripBomStream;
strip-bom-stream-4.0.0/index.js 0000664 0000000 0000000 00000000500 13466033316 0016365 0 ustar 00root root 0000000 0000000 'use strict';
const FirstChunkStream = require('first-chunk-stream');
const stripBomBuffer = require('strip-bom-buf');
module.exports = () =>
new FirstChunkStream({chunkLength: 3}, (error, chunk, encoding, callback) => {
if (error) {
callback(error);
return;
}
callback(null, stripBomBuffer(chunk));
});
strip-bom-stream-4.0.0/index.test-d.ts 0000664 0000000 0000000 00000000446 13466033316 0017607 0 ustar 00root root 0000000 0000000 ///
import * as fs from 'fs';
import {expectType} from 'tsd';
import stripBomStream = require('.');
expectType(stripBomStream());
fs.createReadStream('unicorn.txt')
.pipe(stripBomStream())
.pipe(fs.createWriteStream('unicorn.txt'));
strip-bom-stream-4.0.0/license 0000664 0000000 0000000 00000002125 13466033316 0016272 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) Sindre Sorhus (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
strip-bom-stream-4.0.0/package.json 0000664 0000000 0000000 00000001444 13466033316 0017216 0 ustar 00root root 0000000 0000000 {
"name": "strip-bom-stream",
"version": "4.0.0",
"description": "Strip UTF-8 byte order mark (BOM) from a stream",
"license": "MIT",
"repository": "sindresorhus/strip-bom-stream",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"bom",
"strip",
"byte",
"mark",
"unicode",
"utf8",
"utf-8",
"remove",
"delete",
"trim",
"text",
"stream",
"streams"
],
"dependencies": {
"first-chunk-stream": "^3.0.0",
"strip-bom-buf": "^2.0.0"
},
"devDependencies": {
"@types/node": "^12.0.0",
"ava": "^1.4.1",
"get-stream": "^5.1.0",
"tsd": "^0.7.3",
"xo": "^0.24.0"
}
}
strip-bom-stream-4.0.0/readme.md 0000664 0000000 0000000 00000002010 13466033316 0016475 0 ustar 00root root 0000000 0000000 # strip-bom-stream [](https://travis-ci.org/sindresorhus/strip-bom-stream)
> Strip UTF-8 [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a stream
From Wikipedia:
> 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.
## Install
```
$ npm install strip-bom-stream
```
## Usage
```js
const fs = require('fs');
const stripBomStream = require('strip-bom-stream');
fs.createReadStream('unicorn.txt')
.pipe(stripBomStream())
.pipe(fs.createWriteStream('unicorn.txt'));
```
It's a [`Transform` stream](https://nodejs.org/api/stream.html#stream_class_stream_transform).
## Related
- [strip-bom](https://github.com/sindresorhus/strip-bom) - String version of this module
- [strip-bom-buf](https://github.com/sindresorhus/strip-bom-buf) - Buffer version of this module
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
strip-bom-stream-4.0.0/test.js 0000664 0000000 0000000 00000000672 13466033316 0016247 0 ustar 00root root 0000000 0000000 import fs from 'fs';
import test from 'ava';
import getStream from 'get-stream';
import stripBomStream from '.';
test('main', async t => {
const result = await getStream(fs.createReadStream('fixture').pipe(stripBomStream()));
t.is(result, 'Unicorn\n');
});
test('low `highWaterMark`', async t => {
const result = await getStream(fs.createReadStream('fixture', {highWaterMark: 1}).pipe(stripBomStream()));
t.is(result, 'Unicorn\n');
});