{"id":13465029,"url":"https://github.com/nstepien/iltorb","last_synced_at":"2025-03-25T13:33:00.284Z","repository":{"id":50864328,"uuid":"44492993","full_name":"nstepien/iltorb","owner":"nstepien","description":"Node.js module for brotli compression/decompression with native bindings","archived":true,"fork":false,"pushed_at":"2021-05-28T10:11:25.000Z","size":24064,"stargazers_count":172,"open_issues_count":5,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-07T08:12:28.795Z","etag":null,"topics":["brotli","native-bindings","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nstepien.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-18T19:32:25.000Z","updated_at":"2024-06-06T12:54:31.000Z","dependencies_parsed_at":"2022-09-06T05:21:07.900Z","dependency_job_id":null,"html_url":"https://github.com/nstepien/iltorb","commit_stats":null,"previous_names":["mayhemydg/iltorb"],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstepien%2Filtorb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstepien%2Filtorb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstepien%2Filtorb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstepien%2Filtorb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nstepien","download_url":"https://codeload.github.com/nstepien/iltorb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222081864,"owners_count":16928114,"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":["brotli","native-bindings","nodejs"],"created_at":"2024-07-31T14:00:55.460Z","updated_at":"2024-10-29T16:30:33.249Z","avatar_url":"https://github.com/nstepien.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# iltorb\n\n[![NPM Version][npm-badge]][npm-url]\n[![Travis Build Status][travis-badge]][travis-url]\n[![AppVeyor Build Status][appveyor-badge]][appveyor-url]\n[![CircleCI Build Status][circleci-badge]][circleci-url]\n\n[iltorb](https://www.npmjs.com/package/iltorb) is a [Node.js](https://nodejs.org) package offering native bindings for the [brotli](https://github.com/google/brotli) compression library.\n\n## Install\n\nThis module uses `prebuild` to download a pre-compiled binary for your platform, if it exists. Otherwise, it will use `node-gyp` to build the module.\n\n```\nnpm install iltorb\n```\n\n### Prerequisites for Building\n\nThe following is required to build from source or when a [pre-compiled binary](https://github.com/nstepien/iltorb/releases) does not exist.\n\n- Python 2.7\n- GCC 4.8+ (Unix) or [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) (Windows), see [Node Building tools](https://github.com/nodejs/node-gyp#installation).\n\n## Methods\n\n### Async\n\nOmitting the callback argument will result in the compress and decompress methods to return a Promise.\n\n#### compress(buffer[, brotliEncodeParams][, callback])\n\n```javascript\nconst compress = require('iltorb').compress;\n\n// callback style\ncompress(input, function(err, output) {\n  // ...\n});\n\n// promise style\ncompress(input)\n  .then(output =\u003e /* ... */)\n  .catch(err =\u003e /* ... */);\n\n// async/await style\ntry {\n  const output = await compress(input);\n} catch(err) {\n  // ...\n}\n```\n\n#### decompress(buffer[, callback])\n\n```javascript\nconst decompress = require('iltorb').decompress;\n\n// callback style\ndecompress(input, function(err, output) {\n  // ...\n});\n\n// promise style\ndecompress(input)\n  .then(output =\u003e /* ... */)\n  .catch(err =\u003e /* ... */);\n\n// async/await style\ntry {\n  const output = await decompress(input);\n} catch(err) {\n  // ...\n}\n```\n\n### Sync\n\n#### compressSync(buffer[, brotliEncodeParams])\n\n```javascript\nconst compressSync = require('iltorb').compressSync;\n\ntry {\n  var output = compressSync(input);\n} catch(err) {\n  // ...\n}\n```\n\n#### decompressSync(buffer)\n\n```javascript\nconst decompressSync = require('iltorb').decompressSync;\n\ntry {\n  var output = decompressSync(input);\n} catch(err) {\n  // ...\n}\n```\n\n### Stream\n\n#### compressStream([brotliEncodeParams])\n\n```javascript\nconst compressStream = require('iltorb').compressStream;\nconst fs = require('fs');\n\nfs.createReadStream('path/to/input')\n  .pipe(compressStream())\n  .pipe(fs.createWriteStream('path/to/output'));\n```\n\n##### compressionStream.flush()\n\nCall this method to flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm.\n\n#### decompressStream()\n\n```javascript\nconst decompressStream = require('iltorb').decompressStream;\nconst fs = require('fs');\n\nfs.createReadStream('path/to/input')\n  .pipe(decompressStream())\n  .pipe(fs.createWriteStream('path/to/output'));\n```\n\n### brotliEncodeParams\n\nThe `compress`, `compressSync` and `compressStream` methods may accept an optional `brotliEncodeParams` object to define some or all of brotli's compression parameters:\n- [type definition](https://github.com/google/brotli/blob/v1.0.4/c/enc/params.h#L30-L42)\n- [defaults](https://github.com/google/brotli/blob/v1.0.4/c/enc/encode.c#L706-L720)\n- [explanations](https://github.com/google/brotli/blob/v1.0.4/c/include/brotli/encode.h#L133-L205)\n\n```javascript\nconst brotliEncodeParams = {\n  mode: 0,\n  quality: 11,\n  lgwin: 22,\n  lgblock: 0,\n  disable_literal_context_modeling: false,\n  size_hint: 0, // automatically set for `compress` and `compressSync`\n  large_window: false,\n  npostfix: 0,\n  ndirect: 0\n};\n```\n\n## Troubleshooting\n\n1. I am unable to install `iltorb` because the host (GitHub) that serves the binaries is blocked by my firewall.\n\n    a) By **default**, if the binaries could not be downloaded for any reason, the install script will attempt to compile the binaries locally on your machine. This requires having all of the build requirements fulfilled.\n\n    b) You can override the `binary.host` value found in `package.json` with the following methods:\n\n      - using the following ENV variable `npm_config_iltorb_binary_host=https://domain.tld/path`\n      - as an additional argument with npm install `--iltorb_binary_host=https://domain.tld/path`\n\n      Note: Both of these would result in downloading the binary from `https://domain.tld/path/vX.X.X/iltorb-vX.X.X-node-vXX-arch.tar.gz`\n\n\n[npm-badge]: https://img.shields.io/npm/v/iltorb.svg\n[npm-url]: https://www.npmjs.com/package/iltorb\n[travis-badge]: https://img.shields.io/travis/nstepien/iltorb.svg\n[travis-url]: https://travis-ci.org/nstepien/iltorb\n[appveyor-badge]: https://ci.appveyor.com/api/projects/status/5x96vn5561bixics/branch/master?svg=true\n[appveyor-url]: https://ci.appveyor.com/project/MayhemYDG/iltorb\n[circleci-badge]: https://circleci.com/gh/nstepien/iltorb/tree/master.svg?style=shield\n[circleci-url]: https://circleci.com/gh/nstepien/iltorb/tree/master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstepien%2Filtorb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnstepien%2Filtorb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstepien%2Filtorb/lists"}