0.0.2 β€’ Published 2 years ago

nv-buf-str-seg v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-buf-str-seg

  • calc AND compare the compressed byte-length
  • for compress string using IF string include many 128~256-chars AND chinese-chars

install

  • npm install nv-buf-str-seg

usage

example

	const {split} =require("nv-buf-str-seg")


	var s = "a".repeat(100) + "ζˆ‘".repeat(100) + "b".repeat(100)+ "ΓΏ".repeat(50) + "𝑒".repeat(5) + "c".repeat(100);

	split(s)


	/*
	[
	  [
                //T  L  start  end       L include 5 extra-bytes for hint AND length
	    [ 1, 105, 0,   100 ],          //1 means continuous latin1
	    [ 2, 205, 100, 200 ],          //2 means continuous utf16
	    [ 1, 155, 200, 350 ],       
	    [ 4, 25,  350, 360 ],         //4 means continuous hi-lo utf16
	    [ 1, 105, 360, 460 ]
	  ],
	  { using_sec: 595, using_utf16: 920, using_utf8: 720 }
	]
	*/

METHODS

APIS

LICENSE

  • ISC
0.0.2

2 years ago