{"id":18645452,"url":"https://github.com/cscott/lzjb","last_synced_at":"2025-04-11T12:31:21.482Z","repository":{"id":7300573,"uuid":"8617171","full_name":"cscott/lzjb","owner":"cscott","description":"A fast pure JavaScript implementation of LZJB compression/decompression.","archived":false,"fork":false,"pushed_at":"2013-10-16T18:43:27.000Z","size":1832,"stargazers_count":20,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T13:51:10.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cscott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-07T01:06:25.000Z","updated_at":"2023-09-04T06:44:44.000Z","dependencies_parsed_at":"2022-08-28T01:11:08.883Z","dependency_job_id":null,"html_url":"https://github.com/cscott/lzjb","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cscott%2Flzjb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cscott%2Flzjb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cscott%2Flzjb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cscott%2Flzjb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cscott","download_url":"https://codeload.github.com/cscott/lzjb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401955,"owners_count":21097328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T06:15:57.692Z","updated_at":"2025-04-11T12:31:21.085Z","avatar_url":"https://github.com/cscott.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lzjb\n\n[![Build Status][1]][2] [![dependency status][3]][4] [![dev dependency status][5]][6]\n\n`lzjb` is a fast pure JavaScript implementation of LZJB\ncompression/decompression.  It was originally written by \"Bear\"\nbased on the OpenSolaris C implementations.\nC. Scott Ananian cleaned up the source code and packaged it for `node`\nand `volo`.\n\n## How to install\n\n```\nnpm install lzjb\n```\nor\n```\nvolo add cscott/lzjb\n```\n\nThis package uses\n[Typed Arrays](https://developer.mozilla.org/en-US/docs/JavaScript/Typed_arrays)\nand so requires node.js \u003e= 0.5.5.  Full browser compatibility table\nis available at [caniuse.com](http://caniuse.com/typedarrays); briefly:\nIE 10, Firefox 4, Chrome 7, or Safari 5.1.\n\n## Testing\n\n```\nnpm install\nnpm test\n```\n\n## Usage\n\nThere is a binary available in bin:\n```\n$ bin/lzjb --help\n$ echo \"Test me\" | bin/lzjb -z \u003e test.lzjb\n$ bin/lzjb -d test.lzjb\nTest me\n```\n\nFrom JavaScript:\n```\nvar lzjb = require('lzjb');\nvar data = new Buffer('Example data', 'utf8');\nvar compressed = lzjb.compressFile(data);\nvar uncompressed = lzjb.uncompressFile(compressed);\n// convert from array back to string\nvar data2 = new Buffer(uncompressed).toString('utf8');\nconsole.log(data2);\n```\nThere is a streaming interface as well.\n\nSee the tests in the `tests/` directory for further usage examples.\n\n## Documentation\n\n`require('lzjb')` returns a `lzjb` object.  It contains two main\nmethods.  The first is a function accepting one, two or three parameters:\n\n`lzjb.compressFile = function(input, [output], [Number compressionLevel])`\n\nThe `input` argument can be a \"stream\" object (which must implement the\n`readByte` method), or a `Uint8Array`, `Buffer`, or array.\n\nIf you omit the second argument, `compressFile` will return a JavaScript\narray containing the byte values of the compressed data.  If you pass\na second argument, it must be a \"stream\" object (which must implement the\n`writeByte` method).\n\nThe third argument may be omitted, or a number between 1 and 9 indicating\na compression level (1 being largest/fastest compression and 9 being\nsmallest/slowest compression).  The default is `1`. `6` is about twice\nas slow but creates 10% smaller files.\n\nThe second exported method is a function accepting one or two parameters:\n\n`lzjb.decompressFile = function(input, [output])`\n\nThe `input` parameter is as above.\n\nIf you omit the second argument, `decompressFile` will return a\n`Uint8Array`, `Buffer` or JavaScript array with the decompressed\ndata, depending on what your platform supports.  For most modern\nplatforms (modern browsers, recent node.js releases) the returned\nvalue will be a `Uint8Array`.\n\nIf you provide the second argument, it must be a \"stream\", implementing\nthe `writeByte` method.\n\n## Related projects\n\n* https://code.google.com/p/jslzjb/ Original JavaScript port by Bear\n* http://en.wikipedia.org/wiki/LZJB Wikipedia article on LZJB compression\n* http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/compress.c \"compress\" source code (describes LZJB algorithm)\n* http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/lzjb.c In-kernel implementation of LZJB\n\n## Other JavaScript compressors\n\n* https://github.com/cscott/lzma-purejs LZMA\n* https://github.com/cscott/seek-bzip Bzip2 (random-access decompression)\n\n## License\n\n\u003e Copyright (c) 2010 Nuwa Information Co., Ltd, and individual contributors.\n\u003e\n\u003e Copyright (c) 2013 C. Scott Ananian\n\u003e\n\u003e All rights reserved.\n\u003e\n\u003e Redistribution and use in source and binary forms, with or without\n\u003e modification, are permitted provided that the following conditions are met:\n\u003e\n\u003e   1. Redistributions of source code must retain the above copyright notice,\n\u003e      this list of conditions and the following disclaimer.\n\u003e\n\u003e   2. Redistributions in binary form must reproduce the above copyright\n\u003e      notice, this list of conditions and the following disclaimer in the\n\u003e      documentation and/or other materials provided with the distribution.\n\u003e\n\u003e   3. Neither the name of Nuwa Information nor the names of its contributors\n\u003e      may be used to endorse or promote products derived from this software\n\u003e      without specific prior written permission.\n\u003e\n\u003e THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\u003e AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\u003e IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\u003e DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\u003e FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\u003e DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\u003e SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\u003e CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\u003e OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\u003e OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[1]: https://travis-ci.org/cscott/lzjb.png\n[2]: https://travis-ci.org/cscott/lzjb\n[3]: https://david-dm.org/cscott/lzjb.png\n[4]: https://david-dm.org/cscott/lzjb\n[5]: https://david-dm.org/cscott/lzjb/dev-status.png\n[6]: https://david-dm.org/cscott/lzjb#info=devDependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcscott%2Flzjb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcscott%2Flzjb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcscott%2Flzjb/lists"}