Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codepage

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codepage

pure-JS library to handle codepages

  • 1.15.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-0.99%
Maintainers
1
Weekly downloads
 
Created

What is codepage?

The codepage npm package is a library for converting data between different character encodings. It supports a wide range of code pages and provides functionality for encoding and decoding text.

What are codepage's main functionalities?

Encoding Conversion

Convert strings between different encodings. In this example, we convert a binary string to UTF-8 and vice versa using code page 437.

var cp = require('codepage');
var utf8String = cp.utils.decode(437, Buffer.from('Hello World', 'binary'));
var binaryString = cp.utils.encode(437, 'Hello World');

Stream Transformation

Create a stream that transforms data from one encoding to another. Here, we create a transform stream that encodes incoming data to code page 437.

var cp = require('codepage');
var stream = require('stream');
var converter = new stream.Transform();
converter._transform = function(chunk, encoding, done) {
  this.push(cp.utils.encode(437, chunk.toString()));
done();
};

Handling Code Pages

Access information about different code pages. This code sample retrieves information about code page 437.

var cp = require('codepage');
var cpInfo = cp[437];
console.log(cpInfo.name);

Other packages similar to codepage

Keywords

FAQs

Package last updated on 29 Jul 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc