nv-buf-choose-min-bytelen-string-encode-type
v1.0.1
Published
nv-buf-choose-min-bytelen-string-encode-type ======================= - choose a encode method for string, which has the min post-encode-byte-length - latin1 twob(utf16-without-4bytes) utf8 utf16
Downloads
1
Readme
nv-buf-choose-min-bytelen-string-encode-type
- choose a encode method for string, which has the min post-encode-byte-length
- latin1 twob(utf16-without-4bytes) utf8 utf16
install
- npm install nv-buf-choose-min-bytelen-string-encode-type
splitted
usage
const x = require("nv-buf-choose-min-bytelen-string-encode-type");
x(s: String) -> [codec-name: String, byte-length-after-encode: uint32 ]
example
> x("abcdef")
[ 'latin1', 6 ]
> x("我你他")
[ 'twob', 6 ]
>
> x("a我你他")
[ 'twob', 8 ]
> x("a我bcde")
[ 'utf8', 8 ]
>
> x("a𝑒")
[ 'utf8', 5 ]
>
> x("𝑒我我我")
[ 'utf16', 10 ]
>
> x("abcdef\x80\xff")
[ 'latin1', 8 ]
>
METHODS
APIS
LICENSE
- ISC