🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

encode-decode-data

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encode-decode-data

A Simple npm package to encode and decode the data. Y

1.0.2
latest
npm
Version published
Weekly downloads
4
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

encode-decode-data

A versatile utility package designed for encoding and decoding data in a multitude of schemes, providing a flexible solution for handling different data formats and representations.

Overview

Modern applications often require the ability to encode and decode data using various schemes to meet different standards, interface with diverse systems, or optimize data storage and transmission. Your package simplifies this process by offering a set of functions and a command-line interface (CLI) to seamlessly work with different encoding and decoding schemes.

Features

  • Multiple Encoding Schemes: Support for popular encoding schemes such as Base64, Hex, UTF-8, ASCII, Latin-1, UCS2, UTF-16LE, and Binary, allowing users to choose the most suitable encoding for their use cases.

  • CLI Interface: A user-friendly command-line interface providing easy access to encoding and decoding functionality, allowing users to quickly process data from the terminal.

  • Stream Support: Enable streaming capabilities for efficient processing of large datasets, providing both synchronous and streaming functions to cater to various scenarios.

Installation

npm install encode-decode-data

Usage

CLI Interface

Your package provides a set of commands to encode and decode data interactively from the command line.

Encode

Encode data using different schemes.

enc-dec enc "hello,world" -s hex

Decode

Decode data using different schemes.

enc-dec dec 48656c6c6f2c20776f726c64 -s hex

Encode Stream

Encode data from a file using streams.

enc-dec encode-stream input.txt output.txt -s base64

Decode Stream

Decode data from a file using streams.

enc-dec decode-stream input.txt output.txt -s base64

Node.js Module

You can also use encode-decode-data package programmatically in your Node.js projects.

const { encodeData, decodeData, encodeDataStream, decodeDataStream, EncodingScheme } = require('your-package-name');

const originalData = 'Hello, world!';

const base64EncodedData = encodeData(originalData, EncodingScheme.BASE64);
console.log(base64EncodedData);

const decodedData = decodeData(base64EncodedData, EncodingScheme.BASE64);
console.log(decodedData);

API Reference

encodeData(data: string, scheme?: EncodingScheme): string Encode the input data using the specified encoding scheme. data: The input string to be encoded. scheme: (Optional) The encoding scheme to use (default is BASE64).

decodeData(encodedData: string, scheme?: EncodingScheme): string Decode the input data using the specified decoding scheme. encodedData: The encoded string to be decoded. scheme: (Optional) The decoding scheme to use (default is BASE64).

encodeDataStream(readStream: Readable, writeStream: Writable, scheme?: EncodingScheme): void Encode data from a readable stream and write the encoded data to a writable stream. readStream: The readable stream containing the data to be encoded. writeStream: The writable stream where the encoded data will be written. scheme: (Optional) The encoding scheme to use (default is BASE64).

decodeDataStream(readStream: Readable, writeStream: Writable, scheme?: EncodingScheme): void Decode data from a readable stream and write the decoded data to a writable stream. readStream: The readable stream containing the encoded data to be decoded. writeStream: The writable stream where the decoded data will be written. scheme: (Optional) The decoding scheme to use (default is BASE64).

Contributing

Contributions to encode-decode-data are welcome! If you'd like to contribute to this project, please follow these steps:

  • Fork the repository.
  • Create a new branch for your feature or bug fix: git checkout -b feature/your-feature-name.
  • Commit your changes: git commit -m "Add your feature or fix".
  • Push your branch to your fork: git push origin feature/your-feature-name.
  • Create a pull request on the original repository.

Please follow the Code of Conduct and Contributing Guidelines when contributing.

Buy Me A Coffee

Keywords

encode

FAQs

Package last updated on 15 Jan 2024

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