CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-ulid

tessl install tessl/npm-ulid@3.0.0

A universally-unique, lexicographically-sortable, identifier generator

Agent Success

Agent success rate when using this tile

78%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.34x

Baseline

Agent success rate without this tile

58%

task.mdevals/scenario-4/

Binary Data Encoder

Build a utility that converts binary data to and from a URL-safe text representation using Base32 encoding.

Requirements

Your implementation should provide functionality to:

  1. Encode binary data: Convert binary data (Uint8Array) into a Base32-encoded string
  2. Decode encoded strings: Convert Base32-encoded strings back into binary data (Uint8Array)

The encoded strings should be:

  • URL-safe (no special characters)
  • Case-insensitive
  • Compact and efficient

Test Cases

  • Encoding a Uint8Array containing [72, 101, 108, 108, 111] produces the string "91JPRV3F" @test
  • Decoding the string "91JPRV3F" produces a Uint8Array containing [72, 101, 108, 108, 111] @test
  • Encoding an empty Uint8Array produces an empty string @test
  • Decoding an empty string produces an empty Uint8Array @test

Implementation

@generates

API

/**
 * Encodes binary data into a Base32 string
 * @param input - Binary data as Uint8Array
 * @returns Base32-encoded string
 */
export function encode(input: Uint8Array): string;

/**
 * Decodes a Base32 string back into binary data
 * @param input - Base32-encoded string
 * @returns Binary data as Uint8Array
 */
export function decode(input: string): Uint8Array;

Dependencies { .dependencies }

ulid { .dependency }

Provides Base32 encoding utilities.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/ulid@3.0.x
tile.json