{"id":27111950,"url":"https://github.com/benzinga/lz4js","last_synced_at":"2025-04-07T01:25:32.349Z","repository":{"id":57156730,"uuid":"62664282","full_name":"Benzinga/lz4js","owner":"Benzinga","description":"Lz4 for the browser.","archived":false,"fork":false,"pushed_at":"2023-02-16T13:55:22.000Z","size":31,"stargazers_count":93,"open_issues_count":9,"forks_count":23,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-10T03:30:41.700Z","etag":null,"topics":["javascript","lz4","travis-ci"],"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/Benzinga.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-05T19:37:59.000Z","updated_at":"2025-03-02T11:14:17.000Z","dependencies_parsed_at":"2024-06-18T14:49:01.506Z","dependency_job_id":"6fc00a25-e2ff-4994-85fc-fbae6a3cc649","html_url":"https://github.com/Benzinga/lz4js","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benzinga%2Flz4js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benzinga%2Flz4js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benzinga%2Flz4js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benzinga%2Flz4js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Benzinga","download_url":"https://codeload.github.com/Benzinga/lz4js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247575718,"owners_count":20960820,"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":["javascript","lz4","travis-ci"],"created_at":"2025-04-07T01:25:31.601Z","updated_at":"2025-04-07T01:25:32.334Z","avatar_url":"https://github.com/Benzinga.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lz4.js [![NPM version](https://badge.fury.io/js/lz4js.svg)](https://www.npmjs.com/package/lz4js) [![Build Status](https://travis-ci.org/Benzinga/lz4js.svg?branch=master)](https://travis-ci.org/Benzinga/lz4js) [![codecov](https://codecov.io/gh/Benzinga/lz4js/branch/master/graph/badge.svg)](https://codecov.io/gh/Benzinga/lz4js)\nLz4.js is an implementation of Lz4 designed to be used in web browsers. It contains no dependencies on external libraries or Node.JS, though it is organized as a set of CommonJS modules. It is recommended to use Browserify or WebPack to bundle this for the web browser.\n\n## Installation\n```\nnpm install lz4js\n```\n\n## Usage\n```javascript\nvar lz4 = require(\"lz4js\");\nvar fs = require(\"fs\");\n\n// Compress 128 bytes of zero.\nvar compressed = lz4.compress(new Array(128));\n\n// Decompress.\nvar decompressed = lz4.decompress(compressed);\n\n// Compress file.bin to file.lz4.\nvar data = fs.readFileSync(\"file.bin\");\ncompressed = Buffer.from(lz4.compress(data));\nfs.writeFileSync('file.lz4', compressed);\n```\n\n\u003e **Note**: The high-level `compress` and `decompress` functions deal with framed Lz4 data and do not support raw block data nor legacy Lz4 blocks.\n\n## API\nThe API accepts either `Array`s or `Uint8Array`s. Arrays are expected to be arrays of unsigned 8-bit values. The API will return `Uint8Array`s if the browser supports them, or `Array`s otherwise.\n\n  - `compress(buffer: Array, maxSize: Number): Array`\n\n    Compresses a buffer using Lz4. maxSize sets bounds on the output length; it is recommended to not specify this unless you know what you're doing.\n    Any unused buffer data will be sliced before the buffer is returned.\n\n  - `decompress(buffer: Array, maxSize: Number): Array`\n\n    Decompresses a buffer using Lz4. maxSize sets bounds on the output length; if you know the output length, this will reduce memory usage somewhat.\n    Any unused buffer data will be sliced before the buffer is returned.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenzinga%2Flz4js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenzinga%2Flz4js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenzinga%2Flz4js/lists"}