1.1.0 • Published 3 years ago

@sapphirecode/encoding-helper v1.1.0

Weekly downloads
23
License
MIT
Repository
-
Last release
3 years ago

@sapphirecode/encoding-helper

version: 1.1.x

Converting strings between different encodings

Installation

npm:

npm i --save @sapphirecode/encoding-helper

yarn:

yarn add @sapphirecode/encoding-helper

Usage

const encoding = require('@sapphirecode/encoding-helper');

const hex = encoding.to_hex('abc'); // convert any encoding to hex, default is utf-8
const b64 = encoding.to_b64(hex, 'hex'); // convert any encoding to base64, default is utf-8
const b58 = encoding.to_b58(hex, 'hex'); // convert any encoding to base58, default is utf-8
const utf8 = encoding.to_utf8(hex, 'hex'); // convert any encoding to utf-8, no default
const hexn = encoding.num_to_hex(10); // convert a number to hex
const num = encoding.hex_to_num('a'); // convert hex to a number

supported input encodings:

  • default supported by buffer:
    • ascii
    • base64
    • binary
    • hex
    • latin1
    • ucs-2
    • utf-8
    • utf16le
  • additional encodings:
    • base58

License

MIT © Timo Hocker timo@scode.ovh

1.1.0

3 years ago

1.0.51

4 years ago

1.0.50

4 years ago

1.0.49

4 years ago

1.0.48

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.41

4 years ago

1.0.40

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago