Socket
Socket
Sign inDemoInstall

codecs-encoding

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    codecs-encoding

This is a utility crafted to facilitate encoding and decoding data using various formats, including but not limited to hex, utf8, ascii, and json.


Version published
Weekly downloads
1
Maintainers
1
Install size
101 kB
Created
Weekly downloads
 

Readme

Source

Encoding Codec Utility

Hello! This is a utility crafted to facilitate encoding and decoding data using various formats, including but not limited to hex, utf8, ascii, and json.

Table of Contents

  • Encoding Codec Utility

Overview

The utility is built around the concept of a Codec which can encode and decode data. It has a record of codecs mapped to different encodings. This utility conveniently provides codecs for multiple encoding types and even includes a JSON codec.

Features

  • Buffer Encoding Types: The primary encodings supported are hex, utf8, ascii, binary, base64, ucs2, and utf16le.

  • Additional Encodings: Added support for json, utf-8, and ucs-2 encodings.

  • Extensible: While a set of common encodings are pre-defined, the architecture allows you to seamlessly integrate more if needed.

Installation

(Please include any installation steps if this utility is to be packaged and distributed.)

Usage

Here's a basic usage example:

import codec from './dist/codec.js';

const data = 'Hello, World!';
const encoded = codecs.utf8.encode(data);
const decoded = codecs.utf8.decode(encoded);
console.log(decoded);  // Outputs: Hello, Brad!

Testing

The utility comes with a test suite to ensure that encoding and decoding work correctly. If you're extending the utility or just wish to run tests:

jest codec.test.ts

Contributions

Open to improvements and additional features! If you think something's missing or needs refinement, please feel free to contribute.

Keywords

FAQs

Last updated on 21 Aug 2023

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc