pax_global_header00006660000000000000000000000064134660333160014517gustar00rootroot0000000000000052 comment=8bf097a24ff281e970181810c27be4493e7edaf8 strip-bom-stream-4.0.0/000077500000000000000000000000001346603331600147255ustar00rootroot00000000000000strip-bom-stream-4.0.0/.editorconfig000066400000000000000000000002571346603331600174060ustar00rootroot00000000000000root = 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/.gitattributes000066400000000000000000000000231346603331600176130ustar00rootroot00000000000000* text=auto eol=lf strip-bom-stream-4.0.0/.gitignore000066400000000000000000000000271346603331600167140ustar00rootroot00000000000000node_modules yarn.lock strip-bom-stream-4.0.0/.npmrc000066400000000000000000000000231346603331600160400ustar00rootroot00000000000000package-lock=false strip-bom-stream-4.0.0/.travis.yml000066400000000000000000000000651346603331600170370ustar00rootroot00000000000000language: node_js node_js: - '12' - '10' - '8' strip-bom-stream-4.0.0/fixture000066400000000000000000000000131346603331600163300ustar00rootroot00000000000000Unicorn strip-bom-stream-4.0.0/index.d.ts000066400000000000000000000010371346603331600166270ustar00rootroot00000000000000import 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.js000066400000000000000000000005001346603331600163650ustar00rootroot00000000000000'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.ts000066400000000000000000000004461346603331600176070ustar00rootroot00000000000000/// 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/license000066400000000000000000000021251346603331600162720ustar00rootroot00000000000000MIT 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.json000066400000000000000000000014441346603331600172160ustar00rootroot00000000000000{ "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.md000066400000000000000000000020101346603331600164750ustar00rootroot00000000000000# strip-bom-stream [![Build Status](https://travis-ci.org/sindresorhus/strip-bom-stream.svg?branch=master)](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.js000066400000000000000000000006721346603331600162470ustar00rootroot00000000000000import 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'); });