Socket
Socket
Sign inDemoInstall

isutf8

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    isutf8

Check if a Node.js Buffer or Uint8Array is UTF-8


Version published
Weekly downloads
92K
increased by0.93%
Maintainers
1
Install size
8.83 kB
Created
Weekly downloads
 

Changelog

Source

v4.0.0

  • Drop support for old Node.js < 12.
  • Updated dev deps in package.json.

Readme

Source

NPM Version NPM Downloads Bundlephobia install size

isutf8

Quick check if a Node.js Buffer or Uint8Array is UTF-8.

Install

npm install isutf8

Usage

CommonJS

'use strict';

const isUtf8 = require('isutf8');

const buf = Buffer.from([0xd0, 0x90]);
console.log(isUtf8(buf)); // => true

// or 

const arr = new Uint8Array([0xd0, 0x90]);
console.log(isUtf8(arr)); // => true

ES Modules or TypeScript

import isUtf8 from 'isutf8';

const buf = Buffer.from([0xd0, 0x90]);
console.log(isUtf8(buf)); // => true

// or 

const arr = new Uint8Array([0xd0, 0x90]);
console.log(isUtf8(arr)); // => true

License

MIT License

Keywords

FAQs

Last updated on 31 Oct 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