diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e698302..bd7b2c1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,7 +25,6 @@ jobs: node-version: "22.21.1" registry-url: "https://registry.npmjs.org" - - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 with: version: "10.23.0" diff --git a/README.md b/README.md index 344a9d0..82c14d5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,57 @@ # bytestring -The `bytestring` package contains modules for manipulating byte strings (~ +[![npm version][npm-version-src]][npm-version-href] + +The `bytestring` package provides functions for manipulating byte strings (~ arrays of octets, Uint8Array in modern JavaScript). -The package currently provides the following modules: +Code for each binary-to-text data encoding scheme is placed into a separate module. +Currently the following modules are available: + +- `bytestring/base58` + +## Getting Started + +The package is available via npmjs.org. +Install it with your favourite package manager (npm, pnpm, yarn, …). + +```bash +pnpm add bytestring +``` + +Below is an example of how to use the `base58` module to encode and decode data. +Because the function names are not unique across modules, it is recommended to use a qualified module import. + +Tip: use [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder) and [TextDecoder](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder) to convert between string and Uint8Array. + +```typescript +import * as base58 from 'bytestring/base58'; + +// Assume you have some binary data. +const someBinaryData = new Uint8Array([ /* … */ ]); + +// Encoding with the base58 scheme gives you a (longer) string. +const encodedString = base58.encode(someBinaryData); + +// Now you can show the string to the user, send it in an email etc. +console.log('Base58:', encodedString); +``` + +## Project Management + +This project is managed on GitHub. +Use GitHub Issues for bug reports and feature requests. +Pull requests are welcome. + +## Publishing + +The `bytestring` package is automatically published to [npmjs.org](https://www.npmjs.com/package/bytestring) upon the creation of a new release on GitHub. + +## References + +- https://en.wikipedia.org/wiki/Binary-to-text_encoding + + -- `bytestring/base58` - string (base58) <-> Uint8Array +[npm-version-src]: https://img.shields.io/npm/v/bytestring?style=flat&colorA=131511&colorB=3673b1 +[npm-version-href]: https://npmjs.com/package/bytestring diff --git a/package.json b/package.json index e1fed87..e5b04b2 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "type": "module", "name": "bytestring", "version": "0.0.0", + "description": "Modules for manipulating byte strings", "license": "MIT", "sideEffects": false, "exports": {