{"id":15451955,"url":"https://github.com/hazae41/foras","last_synced_at":"2025-04-07T07:11:43.142Z","repository":{"id":45502326,"uuid":"275252139","full_name":"hazae41/foras","owner":"hazae41","description":"WebAssembly port of Deflate, Gzip, and Zlib compression algorithms","archived":false,"fork":false,"pushed_at":"2024-03-24T19:10:43.000Z","size":2219,"stargazers_count":136,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T18:53:59.201Z","etag":null,"topics":["browser","compression","deflate","deno","gzip","javascript","rust","typescript","wasm","web","webassembly","webcrypto","zlib"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hazae41.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-26T21:36:12.000Z","updated_at":"2024-04-19T14:13:17.000Z","dependencies_parsed_at":"2024-03-24T20:24:26.853Z","dependency_job_id":"b91475fe-e977-4bec-9cb4-abed43cb7879","html_url":"https://github.com/hazae41/foras","commit_stats":{"total_commits":48,"total_committers":5,"mean_commits":9.6,"dds":0.5208333333333333,"last_synced_commit":"8df1f9286ecbc7a9b9dcd49ee6c1ece754574b99"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fforas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fforas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fforas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fforas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hazae41","download_url":"https://codeload.github.com/hazae41/foras/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247607899,"owners_count":20965948,"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":["browser","compression","deflate","deno","gzip","javascript","rust","typescript","wasm","web","webassembly","webcrypto","zlib"],"created_at":"2024-10-01T21:40:34.666Z","updated_at":"2025-04-07T07:11:43.124Z","avatar_url":"https://github.com/hazae41.png","language":"TypeScript","readme":"\u003cdiv\u003e\n  \u003cimg align=\"right\" width=\"128\" src=\"https://user-images.githubusercontent.com/4405263/216623921-fc3ea95c-6875-47a4-ada8-4a5b8f1afafd.png\"/\u003e\n  \u003cp\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n# Foras\n\nWebAssembly port of Deflate, Gzip, and Zlib compression algorithms\n\n**DEPRECATED**: You should use native [Compression Streams](https://developer.mozilla.org/en-US/docs/Web/API/Compression_Streams_API) instead\n\n```bash\nnpm i @hazae41/foras\n```\n\n[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/foras) • [**Deno Module 🦖**](https://deno.land/x/foras) • [**Next.js CodeSandbox 🪣**](https://codesandbox.io/p/github/hazae41/foras-example-next)\n\n## Algorithms\n- Deflate from flate2\n- Gzip from flate2\n- Zlib from flate2\n\n## Features\n- Reproducible building\n- Pre-bundled and streamed\n- Zero-copy memory slices\n\n## Usage\n\n### Direct\n\n```ts\nimport { Foras, deflate, inflate } from \"@hazae41/foras\";\n// or { Foras, gzip, gunzip }\n// or { Foras, zlib, unzlib }\n\n// Wait for WASM to load\nawait Foras.initBundledOnce()\n\nconst bytes = new TextEncoder().encode(\"Hello world\")\n\nconst compressed = deflate(bytes).copyAndDispose()\nconst decompressed = inflate(compressed).copyAndDispose()\n```\n\n### Streaming\n\n```ts\nimport { Foras, DeflateEncoder, DeflateDecoder } from \"@hazae41/foras\";\n// or { Foras, GzEncoder, GzDecoder }\n// or { Foras, ZlibEncoder, ZlibDecoder }\n\n// Wait for WASM to load\nawait Foras.initBundledOnce()\n\nconst bytes = new TextEncoder().encode(\"Hello world\")\n\nconst compresser = new DeflateEncoder()\ncompresser.write(bytes)\ncompresser.flush()\n\nconst compressed1 = compresser.read().copyAndDispose()\nconst compressed2 = compresser.finish().copyAndDispose()\n\ncompresser.free()\n```\n\n## Building\n\n### Unreproducible building\n\nYou need to install [Rust](https://www.rust-lang.org/tools/install)\n\nThen, install [wasm-pack](https://github.com/rustwasm/wasm-pack)\n\n```bash\ncargo install wasm-pack\n```\n\nFinally, do a clean install and build\n\n```bash\nnpm ci \u0026\u0026 npm run build\n```\n\n### Reproducible building\n\nYou can build the exact same bytecode using Docker, just be sure you're on a `linux/amd64` host\n\n```bash\ndocker compose up --build\n```\n\nThen check that all the files are the same using `git status`\n\n```bash\ngit status --porcelain\n```\n\nIf the output is empty then the bytecode is the same as the one I commited\n\n### Automated checks\n\nEach time I commit to the repository, the GitHub's CI does the following:\n- Clone the repository\n- Reproduce the build using `docker compose up --build`\n- Throw an error if the `git status --porcelain` output is not empty\n\nEach time I release a new version tag on GitHub, the GitHub's CI does the following:\n- Clone the repository\n- Do not reproduce the build, as it's already checked by the task above\n- Throw an error if there is a `npm diff` between the cloned repository and the same version tag on NPM\n\nIf a version is present on NPM but not on GitHub, do not use!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazae41%2Fforas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhazae41%2Fforas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazae41%2Fforas/lists"}