Socket
Socket
Sign inDemoInstall

strip-bom

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    strip-bom

Strip UTF-8 byte order mark (BOM) from a string


Version published
Weekly downloads
61M
increased by2.55%
Maintainers
1
Install size
4.56 kB
Created
Weekly downloads
 

Package description

What is strip-bom?

The strip-bom package is used to remove a UTF-8 byte order mark (BOM) from the beginning of a string. This is particularly useful when dealing with files or data streams that may have been saved with a BOM, which can cause issues when processing or parsing the text.

What are strip-bom's main functionalities?

Removing BOM from a string

This code demonstrates how to use strip-bom to remove a byte order mark from the beginning of a string. It's useful for processing text that originates from files encoded with a BOM.

const stripBom = require('strip-bom');

const stringWithBom = '\uFEFFThis is a test string.';
const cleanedString = stripBom(stringWithBom);

console.log(cleanedString); // 'This is a test string.'

Other packages similar to strip-bom

Readme

Source

strip-bom

Strip UTF-8 byte order mark (BOM) from a string

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

Usage

import stripBom from 'strip-bom';

stripBom('\uFEFFunicorn');
//=> 'unicorn'

Get professional support for 'strip-bom' with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

Last updated on 16 Apr 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc