Skip to content

jimmywarting/wt-common

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Common package

This is a common utility package to abstrack away the differences between a few node:buffer utilities that regular Uint8Array can't do on it's own or with the help of any other tools like TextEncoder/TextDecoder or DataView, it's mainly used for hex conversion and converting mostly anything (string, ArrayBuffer, ArrayBufferView) to Uint8Arrays with toUint8() it also exports a getRandomValues and a promise based sha1 from node crypto and web crypto

  • arr2hex(arr: Uint8Array): string

  • hex2arr(hex: string): Uint8Array

  • binary2hex(binary: string): string

  • hex2binary(hex: string): string

  • text2arr(text: string): Uint8Array

  • arr2text(view: Uint8Array): string

  • sha1(view: Uint8Array): Promise<Uint8Array>

  • toUint8(any): Uint8Array

  • getRandomValues(view: ArrayBufferView): ArrayBufferView

This package was built for WebTorrent to work better cross platform and apply a onion architecture

About

Common package for dealing with hex/string/uint8 conversions (and sha1 hashing)

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors