{"id":17271823,"url":"https://github.com/jawj/littlezipper","last_synced_at":"2025-04-05T12:03:46.992Z","repository":{"id":224239231,"uuid":"762497437","full_name":"jawj/littlezipper","owner":"jawj","description":"Small, fast .zip library using native CompressionStream, suits server and client","archived":false,"fork":false,"pushed_at":"2025-02-04T16:24:23.000Z","size":157,"stargazers_count":56,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T11:06:28.933Z","etag":null,"topics":["compressionstream","javascript","pkzip","tiny","typescript","zip"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/jawj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-02-23T22:45:42.000Z","updated_at":"2025-02-24T18:21:19.000Z","dependencies_parsed_at":"2024-02-24T18:42:24.371Z","dependency_job_id":"cb3adafd-8788-4e40-ace5-32c2dd6287cc","html_url":"https://github.com/jawj/littlezipper","commit_stats":null,"previous_names":["jawj/zipkiss","jawj/littlezip"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Flittlezipper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Flittlezipper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Flittlezipper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawj%2Flittlezipper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jawj","download_url":"https://codeload.github.com/jawj/littlezipper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332560,"owners_count":20921853,"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":["compressionstream","javascript","pkzip","tiny","typescript","zip"],"created_at":"2024-10-15T08:47:06.645Z","updated_at":"2025-04-05T12:03:46.961Z","avatar_url":"https://github.com/jawj.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# littlezipper\n\nThis project uses the `CompressionStream` API — supported by all recent browsers, Node and Deno — to create `.zip` files.\n\nThis is not wholly trivial since, a little frustratingly, `CompressionStream` can natively produce `.gz` format data but not `.zip`. Thus, we pick out both the deflated data and the CRC from the `.gz` stream, and write them into a `.zip` file instead.\n\nWe don't actually have to implement any compression in JavaScript, so the library is fast and small.\n\nWhere `CompressionStream` is not available, we fall back to producing uncompressed `.zip` files (and calculate the CRC in heavily-optimized JavaScript). This may be acceptable if you are creating a `.zip` that is actually something else, such as an `.xlsx`, `.apk` or `.xpi`.\n\nThe library is currently suitable for small- and medium-sized files, since it briefly requires just over 2x the total uncompressed size of your files in memory. That's because you pass it an array of files data, and for the `.zip` output it allocates a `Uint8Array` backed by a worst-case `ArrayBuffer`, which is the size of all the uncompressed data plus a little more for headers.\n\nPotential future improvements could include implementing a `TransformStream` instead, which could enable smaller memory use and larger file sizes. However, the `.zip` format annoyingly puts the CRC and compressed data size _before_ the compressed data, which limits opportunities for memory saving.\n\n## Installation\n\n```bash\nnpm install littlezipper\n```\n\nTypeScript types are included.\n\n## Usage\n\nThe library exposes a single function, `createZip`.\n\n```typescript\nimport { createZip } from 'littlezipper'; \n\nconst zip = await createZip([\n  { path: 'test.txt', data: 'This is a test', lastModified: new Date('2020-01-01T00:00:00') },\n  { path: 'test.bin', data: new Uint8Array([1, 2, 3]) },\n]);\n```\n\nThe first argument to `createZip` is an array of file entries. Each entry must have `path` (`string`) and `data` (`string`, `Uint8Array` or `ArrayBuffer`) keys, and may have a `lastModified` (`Date`) key, which otherwise defaults to the current date and time.\n\nThe optional second argument defines whether we attempt to deflate the data (default: `true`). If `false`, the resulting `.zip` file will be as large as the input data plus a few bytes for headers.\n\n## License\n\n[Apache License, Version 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawj%2Flittlezipper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawj%2Flittlezipper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawj%2Flittlezipper/lists"}