{"id":13671320,"url":"https://github.com/sindresorhus/gzip-size","last_synced_at":"2025-04-08T12:10:57.427Z","repository":{"id":14581437,"uuid":"17297834","full_name":"sindresorhus/gzip-size","owner":"sindresorhus","description":"Get the gzipped size of a string or buffer","archived":false,"fork":false,"pushed_at":"2021-11-23T07:55:36.000Z","size":43,"stargazers_count":171,"open_issues_count":1,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-01T11:03:58.526Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-02-28T19:55:14.000Z","updated_at":"2025-01-07T20:10:54.000Z","dependencies_parsed_at":"2022-09-06T05:20:16.761Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/gzip-size","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fgzip-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fgzip-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fgzip-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fgzip-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/gzip-size/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246961950,"owners_count":20861181,"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-08-02T09:01:06.088Z","updated_at":"2025-04-08T12:10:57.405Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate","https://tidelift.com/subscription/pkg/npm-gzip-size?utm_source=npm-gzip-size\u0026utm_medium=referral\u0026utm_campaign=readme"],"categories":["JavaScript"],"sub_categories":[],"readme":"# gzip-size\n\n\u003e Get the gzipped size of a string or buffer\n\n## Install\n\n```sh\nnpm install gzip-size\n```\n\n## Usage\n\n```js\nimport {gzipSize, gzipSizeSync} from 'gzip-size';\n\nconst text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.';\n\nconsole.log(text.length);\n//=\u003e 191\n\nconsole.log(gzipSizeSync(text));\n//=\u003e 78\n```\n\n## API\n\n### gzipSize(input, options?)\n\nReturns a `Promise\u003cnumber\u003e` with the size.\n\n### gzipSizeSync(input, options?)\n\nReturns the size.\n\n#### input\n\nType: `string | Buffer`\n\n#### options\n\nType: `object`\n\nAny [`zlib` option](https://nodejs.org/api/zlib.html#zlib_class_options).\n\n### gzipSizeFromFile(path, options?)\n\nReturns a `Promise\u003cnumber\u003e` with the size of the file.\n\n#### path\n\nType: `string`\n\n### gzipSizeFromFileSync(path, options?)\n\nReturns the size of the file.\n\n### gzipSizeStream(options?)\n\nReturns a [`stream.PassThrough`](https://nodejs.org/api/stream.html#stream_class_stream_passthrough). The stream emits a `gzip-size` event and has a `gzipSize` property.\n\n## Related\n\n- [gzip-size-cli](https://github.com/sindresorhus/gzip-size-cli) - CLI for this module\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cb\u003e\n\t\t\u003ca href=\"https://tidelift.com/subscription/pkg/npm-gzip-size?utm_source=npm-gzip-size\u0026utm_medium=referral\u0026utm_campaign=readme\"\u003eGet professional support for this package with a Tidelift subscription\u003c/a\u003e\n\t\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003csub\u003e\n\t\tTidelift helps make open source sustainable for maintainers while giving companies\u003cbr\u003eassurances about security, maintenance, and licensing for their dependencies.\n\t\u003c/sub\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fgzip-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fgzip-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fgzip-size/lists"}