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

github.com/oleiade/xk6-encoding

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/oleiade/xk6-encoding

v0.0.0-20231105110158-b3b6d3d4f213
Source
Go
Version published
Created
Source

TextEncoder and TextDecoder implementations for k6

Welcome to xk6-encoding, an xk6 extension that brings support for Javascript's TextEncoder and TextDecoder to k6, enabling you to seamlessly handle various text encodings during your performance tests.

Features

  • Text Encoding: Convert your strings into byte streams with support for various encoding formats including UTF-8, UTF-16, and Windows-1252.
  • Text Decoding: Decode byte streams back to strings with ease, even when processing the data in chunks.
  • Flexible Options: Handle Byte Order Marks (BOM) and determine behavior on decoding invalid data.

Why Use xk6-encoding?

If you're working with systems that utilize various text encodings or if you're aiming to test the performance of encoding/decoding tasks, this extension will be invaluable for your k6 tests.

Getting Started

  • Make sure you have the latest version of the xk6 tool installed:
go install go.k6.io/xk6/cmd/xk6@latest
  • Build your custom k6 binary:
xk6 build --with github.com/oleiade/xk6-encoding@latest
  • Use in your k6 script: To encode text:
import { TextEncoder } from 'k6/encoding';
const encoder = new TextEncoder("utf-8");
const encoded = encoder.Encode("Your text here");

To decode text:

import { TextDecoder } from 'k6/encoding';
const decoder = new TextDecoder("utf-8");
const decoded = decoder.Decode(encodedData);
  • Run your k6 test with the custom k6 binary you built:
./k6 run your-test-script.js

Supported Encodings

  • utf-8: Standard encoding for the web.
  • utf-16le and utf-16be: Unicode encodings that can represent any character in the Unicode standard.
  • windows-1252: A character encoding of the Latin alphabet, used by default in the legacy components of Microsoft Windows.

Contributing

Your contributions are always welcome! If you discover an issue or have a feature request, please open an issue on the GitHub repository.

FAQs

Package last updated on 05 Nov 2023

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