Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
strip-bom-stream
Advanced tools
The strip-bom-stream npm package is used to remove Byte Order Marks (BOM) from streams. BOMs are special markers at the start of text streams that indicate the encoding used. This package is particularly useful when dealing with text streams that may contain BOMs, ensuring that the BOM is stripped out so that the text can be processed correctly.
Remove BOM from a stream
This feature allows you to remove the BOM from a readable stream and pipe the cleaned data into a writable stream. In this example, the BOM is removed from 'file-with-bom.txt' and the result is written to 'file-without-bom.txt'.
const fs = require('fs');
const stripBomStream = require('strip-bom-stream');
fs.createReadStream('file-with-bom.txt')
.pipe(stripBomStream())
.pipe(fs.createWriteStream('file-without-bom.txt'));
The strip-bom package is used to remove BOM from strings and buffers. Unlike strip-bom-stream, which works with streams, strip-bom is more suited for handling individual strings or buffers. It is useful when you need to process text data that is already loaded into memory.
The remove-bom-stream package is another alternative for removing BOM from streams. It functions similarly to strip-bom-stream but may have different performance characteristics or additional features. It is a good alternative if you are looking for similar functionality.
Strip UTF-8 byte order mark (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.
$ npm install strip-bom-stream
import fs from 'node:fs';
import stripBomStream from 'strip-bom-stream';
fs.createReadStream('unicorn.txt')
.pipe(stripBomStream())
.pipe(fs.createWriteStream('unicorn.txt'));
It's a Transform
stream.
FAQs
Strip UTF-8 byte order mark (BOM) from a stream
The npm package strip-bom-stream receives a total of 869,507 weekly downloads. As such, strip-bom-stream popularity was classified as popular.
We found that strip-bom-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.