{"_id":"@cley_faye/lzw","_rev":"3-2c15bad561cb94056f7fbd987c0b5935","name":"@cley_faye/lzw","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@cley_faye/lzw","version":"1.0.0","keywords":["lzw","compression"],"author":{"name":"Gabriel Paul \"Cley Faye\" Risterucci"},"license":"MIT","_id":"@cley_faye/lzw@1.0.0","maintainers":[{"name":"cley_faye","email":"cleyfaye@gmail.com"}],"dist":{"shasum":"d1969f08b864402405201791608afa817fbd5852","tarball":"https://registry.npmjs.org/@cley_faye/lzw/-/lzw-1.0.0.tgz","fileCount":50,"integrity":"sha512-IplATFBGoOTN877m0p+QCNUYsOt2JRIxxv/WbfNXbTGQx6MUVwyjYc2vvjWPr+cOsskxwzXQySOT+3CVgeKhRw==","signatures":[{"sig":"MEQCIFRv8x2kkE3JrFLCYqqegW7WtCOStFDdLVfkZpskHvrvAiBxZpAKwUUWEI7gakAKnRCQ6TNEE9Hk4DbkTHJkisFE3w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55086},"main":"./lib/index.js","type":"module","tslib":{"knip":{"ignoreDependencies":["@babel/plugin-syntax-import-attributes","ts-node"]},"exports":{"enabled":true,"private":["./arrays/*.ts","./buf8/*.ts","./core/*.ts"]},"buildWeb":true},"types":"./lib/index.d.ts","exports":{".":"./lib/index.js","./index.js":{"node":"./lib/index.js","browser":"./web/index.js","default":"./lib/index.js","react-native":"./web/index.js"}},"gitHead":"7fa22096a2af081541bf6654409eef9b576fb5b7","scripts":{"test":"tslib test","build":"tslib build","check":"tslib check","clean":"tslib clean","prepack":"npm run build"},"_npmUser":{"name":"cley_faye","email":"cleyfaye@gmail.com"},"_npmVersion":"11.13.0","description":"Pure JavaScript implementation of LZW compression","directories":{},"_nodeVersion":"24.17.0","_hasShrinkwrap":false,"devDependencies":{"c8":"^11.0.0","knip":"^6.18.0","mocha":"^11.7.6","eslint":"^9.39.4","globals":"^17.7.0","ts-node":"^10.9.2","typedoc":"^0.28.19","prettier":"^3.8.4","@swc/core":"^1.15.43","@babel/cli":"^7.29.7","@eslint/js":"^9.39.4","typescript":"^6.0.3","@babel/core":"^7.29.7","@types/node":"^24.13.2","@keeex/tslib":"^2.15.1","@types/mocha":"^10.0.10","@babel/preset-env":"^7.29.7","typescript-eslint":"^8.62.0","eslint-plugin-mocha":"^11.3.0","eslint-plugin-tsdoc":"^0.5.2","@keeex/eslint-config":"^2.6.3","eslint-plugin-promise":"^7.3.0","eslint-plugin-import-x":"^4.17.0","babel-plugin-import-redirect":"^1.1.1","typedoc-plugin-missing-exports":"^4.1.3","typedoc-plugin-rename-defaults":"^0.7.3","eslint-import-resolver-typescript":"^4.4.5","@babel/plugin-syntax-import-attributes":"^7.29.7"},"_npmOperationalInternal":{"tmp":"tmp/lzw_1.0.0_1782171514555_0.009751682846219634","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@cley_faye/lzw","version":"1.0.1","keywords":["lzw","compression"],"author":{"name":"Gabriel Paul \"Cley Faye\" Risterucci"},"license":"MIT","_id":"@cley_faye/lzw@1.0.1","maintainers":[{"name":"cley_faye","email":"cleyfaye@gmail.com"}],"dist":{"shasum":"0bdeaa158a3015f87631fffa0ebc7bf4034efad8","tarball":"https://registry.npmjs.org/@cley_faye/lzw/-/lzw-1.0.1.tgz","fileCount":50,"integrity":"sha512-TuaoUJAnnfcOc9i2zdWejmCCmzpMhn7ZEjTSvw+qA8kssx3a9Wb819T9kCBUdsaNFTXu3vHeF+jnjiDqxrz76A==","signatures":[{"sig":"MEUCIHORn0rnsshjQIvtTrjAUmnamsmP0TSzOeID7PxIE+OtAiEAjDcPmKbhESQpz+vXu3uwKkAAtPlEHq3iEcf/jIiCW8Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55088},"main":"./lib/index.js","type":"module","tslib":{"knip":{"ignoreDependencies":["@babel/plugin-syntax-import-attributes","ts-node"]},"exports":{"enabled":true,"private":["./arrays/*.ts","./buf8/*.ts","./core/*.ts"]},"buildWeb":true},"types":"./lib/index.d.ts","exports":{".":"./lib/index.js","./index.js":{"node":"./lib/index.js","browser":"./web/index.js","default":"./lib/index.js","react-native":"./web/index.js"}},"gitHead":"b8ba9ffbdfd332250aa91e74baa9ff09b0975d9a","scripts":{"test":"tslib test","build":"tslib build","check":"tslib check","clean":"tslib clean","prepack":"npm run build"},"_npmUser":{"name":"cley_faye","email":"cleyfaye@gmail.com"},"_npmVersion":"11.13.0","description":"Pure JavaScript implementation of LZW compression","directories":{},"_nodeVersion":"24.17.0","_hasShrinkwrap":false,"devDependencies":{"c8":"^11.0.0","knip":"^6.18.0","mocha":"^11.7.6","eslint":"^9.39.4","globals":"^17.7.0","ts-node":"^10.9.2","typedoc":"^0.28.19","prettier":"^3.8.4","@swc/core":"^1.15.43","@babel/cli":"^7.29.7","@eslint/js":"^9.39.4","typescript":"^6.0.3","@babel/core":"^7.29.7","@types/node":"^24.13.2","@keeex/tslib":"^2.15.1","@types/mocha":"^10.0.10","@babel/preset-env":"^7.29.7","typescript-eslint":"^8.62.0","eslint-plugin-mocha":"^11.3.0","eslint-plugin-tsdoc":"^0.5.2","@keeex/eslint-config":"^2.6.3","eslint-plugin-promise":"^7.3.0","eslint-plugin-import-x":"^4.17.0","babel-plugin-import-redirect":"^1.1.1","typedoc-plugin-missing-exports":"^4.1.3","typedoc-plugin-rename-defaults":"^0.7.3","eslint-import-resolver-typescript":"^4.4.5","@babel/plugin-syntax-import-attributes":"^7.29.7"},"_npmOperationalInternal":{"tmp":"tmp/lzw_1.0.1_1782174778695_0.7498898923370187","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"author":{"name":"Gabriel Paul \"Cley Faye\" Risterucci"},"description":"Pure JavaScript implementation of LZW compression","devDependencies":{"@babel/cli":"^7.29.7","@babel/core":"^7.29.7","@babel/plugin-syntax-import-attributes":"^7.29.7","@babel/preset-env":"^7.29.7","@eslint/js":"^9.39.4","@keeex/eslint-config":"^2.6.3","@keeex/tslib":"^2.15.1","@swc/core":"^1.15.43","@types/mocha":"^10.0.10","@types/node":"^24.13.2","babel-plugin-import-redirect":"^1.1.1","c8":"^11.0.0","eslint":"^9.39.4","eslint-import-resolver-typescript":"^4.4.5","eslint-plugin-import-x":"^4.17.0","eslint-plugin-mocha":"^11.3.0","eslint-plugin-promise":"^7.3.0","eslint-plugin-tsdoc":"^0.5.2","globals":"^17.7.0","knip":"^6.18.0","mocha":"^11.7.6","prettier":"^3.8.4","ts-node":"^10.9.2","typedoc":"^0.28.19","typedoc-plugin-missing-exports":"^4.1.3","typedoc-plugin-rename-defaults":"^0.7.3","typescript":"^6.0.3","typescript-eslint":"^8.62.0"},"exports":{".":"./lib/index.js","./index.js":{"node":"./lib/index.js","browser":"./web/index.js","react-native":"./web/index.js","default":"./lib/index.js"},"./pad.js":{"node":"./lib/pad.js","browser":"./web/pad.js","react-native":"./web/pad.js","default":"./lib/pad.js"}},"keywords":["lzw","compression"],"license":"MIT","main":"./lib/index.js","name":"@cley_faye/lzw","scripts":{"build":"tslib build","check":"tslib check","clean":"tslib clean","prepack":"npm run clean && npm run build","test":"tslib test"},"tslib":{"buildWeb":true,"excludeFromBuild":["pad.ts"],"exports":{"enabled":true,"private":["./arrays/*.ts","./buf8/*.ts","./core/*.ts"]},"knip":{"ignoreDependencies":["@babel/plugin-syntax-import-attributes","ts-node"]}},"type":"module","version":"2.0.0","gitHead":"5c2ae5e969bf2d434811d953dcf7773a782e96c7","types":"./lib/index.d.ts","_id":"@cley_faye/lzw@2.0.0","_nodeVersion":"24.17.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-rsZAw6i7B5VgQIsV3+IUUwohP8UOaKO5uWqW1hZ/pSm01/8/lzxC4HfPkEXIv65oIimCxybtKY1/WUmbd3aBlw==","shasum":"2e63c6e66ccbd29da03397994f4e313e8087190c","tarball":"https://registry.npmjs.org/@cley_faye/lzw/-/lzw-2.0.0.tgz","fileCount":59,"unpackedSize":62250,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBzV9tTCjdKX64aZbjVq/vs9X5a2WjzTLa7pG8KcIs4nAiEAt7Ni9jMD6/DXK0WCbGJJVvDnRPofRKmaGv8vourGRN8="}]},"_npmUser":{"name":"cley_faye","email":"cleyfaye@gmail.com"},"directories":{},"maintainers":[{"name":"cley_faye","email":"cleyfaye@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lzw_2.0.0_1782252695501_0.8464833363406448"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-22T23:38:34.403Z","modified":"2026-06-23T22:11:35.737Z","1.0.0":"2026-06-22T23:38:34.709Z","1.0.1":"2026-06-23T00:32:58.883Z","2.0.0":"2026-06-23T22:11:35.632Z"},"author":{"name":"Gabriel Paul \"Cley Faye\" Risterucci"},"license":"MIT","keywords":["lzw","compression"],"description":"Pure JavaScript implementation of LZW compression","maintainers":[{"name":"cley_faye","email":"cleyfaye@gmail.com"}],"readme":"# `@cley_faye/lzw`\n\nPure JavaScript implementation of LZW compression\n\nProvide a low-level implementation of the LZW algorithm as well as minimal\nsupport for compression/decompression of byte buffers.\n\n## Installation\n\n```shell\nnpm install @cley_faye/lzw\n```\n\n## Usage\n\nThe package uses the JavaScript ES module syntax.\n\n### Low-level usage\n\nAt low-level, LZW only handle numeric \"codes\" for both input and output.\nIt is possible to create an instance able to compress any input dictionary, but\nfor convenience functions to create a \"byte\" dictionary (handling all 256\nvalues) is provided.\n\nHow to compress and decompress a sequence of input codes:\n\n```JavaScript\nimport {CodeCompress, CodeDecompress} from \"@cley_faye/lzw\";\n\nconst input = [1, 2, 3, 4];\n// Compression\nconst compress = CodeCompress.createSingleBytes();\nconst compressed = [];\ninput.forEach(inputCode => {\n  const outputCodes = compress.addInput(inputCode);\n  if (outputCodes) {\n    compressed.push(...outputCodes);\n  }\n});\nconst finalCodes = compress.endInput();\nif (finalCodes) {\n  compressed.push(...finalCodes);\n}\nconsole.log(compressed);\n// Decompression\nconst decompress = CodeDecompress.createSingleBytes();\nconst decompressed = [];\ncompressed.forEach(inputCode => {\n  const outputCodes = decompress.addInput(inputCode);\n  decompressed.push(...outputCodes);\n});\nconsole.log(decompressed);\n```\n\n### Usage with Uint8Array\n\nEncoding of output codes into sequence of bits/bytes is also included.\n\nHere's a basic example:\n\n```JavaScript\nimport {CompressBuf8, DecompressBuf8} from \"@cley_faye/lzw\";\n\nconst input = new Uint8Array([1, 2, 3, 4]);\n// Compression\nconst compressed = CompressBuf8.compressBytes(input);\n// Decompression\nconst decompressed = DecompressBuf8.decompressBytes(compressed);\n```\n\nYou can also process chunks by creating an instance of `CompressBuf8` or `DecompressBuf8`.\n\n#### Encoding\n\nThis is incompatible with streams made with the version 1 of this library.\nCompressed `Uint8Array` are prefixed with a single byte indicating the settings from the compressor.\nBeyond that first byte, dictionary codes are output using the least amount of bit necessary to\nrepresent the largest entry of the dictionary.\nIf configured, a reset code (256) and a stop code (257, or 256 if no reset code) are added to the\ndictionary on start/reset.\nThe initial 256 first values of the dictionary are just their corresponding byte.\n\n## Settings\n\nThe library exposes most settings expected when handling LZW.\nMost notably:\n\n- Setting a limit to the dictionary size can be done using the `maxCodeValue`\n  argument, either when creating a custom dictionary or with helper functions.\n- Outputing a \"stop\" code can be disabled with the `setStop` argument\n- Storage order (most significant bit first or not) is handled with the `msb`\n  argument.\n\nIt is advised to leave the default values for `setStop` (true) and `msb` (true).\nSpecifying a value for `maxCodeValue` will lower compression efficiency, but also limit the memory\nneeded to compress/decompress, as the dictionary can grow quite large quite fast.\n","readmeFilename":"README.md"}