{"id":17335436,"url":"https://github.com/vigneshshanmugam/compress-payload","last_synced_at":"2025-04-14T18:30:22.142Z","repository":{"id":57204979,"uuid":"233579606","full_name":"vigneshshanmugam/compress-payload","owner":"vigneshshanmugam","description":"Utiliy for compressing and decompressing RUM payload data","archived":false,"fork":false,"pushed_at":"2020-07-21T12:59:34.000Z","size":8,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T06:51:16.192Z","etag":null,"topics":["compression","decompression","payload","rum"],"latest_commit_sha":null,"homepage":"","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/vigneshshanmugam.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}},"created_at":"2020-01-13T11:25:10.000Z","updated_at":"2023-03-08T04:34:24.000Z","dependencies_parsed_at":"2022-09-18T00:51:49.440Z","dependency_job_id":null,"html_url":"https://github.com/vigneshshanmugam/compress-payload","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigneshshanmugam%2Fcompress-payload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigneshshanmugam%2Fcompress-payload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigneshshanmugam%2Fcompress-payload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigneshshanmugam%2Fcompress-payload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vigneshshanmugam","download_url":"https://codeload.github.com/vigneshshanmugam/compress-payload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248601038,"owners_count":21131593,"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":["compression","decompression","payload","rum"],"created_at":"2024-10-15T15:09:59.243Z","updated_at":"2025-04-14T18:30:22.093Z","avatar_url":"https://github.com/vigneshshanmugam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# compress-payload\n\nUtiliy for compressing and decompressing RUM payload data using Compression and Decompression streams.\nThis module is based on [Compression Streams specification](https://wicg.github.io/compression/).\n\n## API\n\n```js\nimport { compress, decompress, view } from \"compress-payload\";\n\nconst payloadObject = {\n  /*Huge JSON RUM data*/\n};\nconst payload = JSON.stringify(payloadObject);\nconst compressedBlob = await compress(payload, \"gzip\");\nconst decompressedBlob = await decompress(compressedBlob, \"gzip\");\n\n// View the original payload content\nconst originalPayload = await view(decompressedBlob);\n```\n\n### Fallback for old browsers\n\nAs the API is only available in\n(https://www.chromestatus.com/features#compression)[Chrome \u003e 80], we can feature\ndetect and use this library only for non supported browsers.\n\n```js\nconst isCompressionStreamSupported = typeof CompressionStream === \"function\";\n\nlet payload = JSON.stringify(payloadObject); // uncompressed\nif (isCompressionStreamSupported) {\n  payload = await compress(payload, \"gzip\");\n}\n\nnavigator.sendBeacon(\"/rum/endpoint\", payload);\n```\n\n##### compress(payload, type)\n\n---\n\nCompress the payload using the `CompressionStream`. `type` denotes either `gzip` or `deflate`. (default - gzip)\n\n##### decompress(blob, type)\n\n---\n\nDecompress the compressed blob data extracted by calling `compress(payload, data)`\n\n##### view(blob)\n\n---\n\nRead the entire contents of the blob interpreted as UTF-8 text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvigneshshanmugam%2Fcompress-payload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvigneshshanmugam%2Fcompress-payload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvigneshshanmugam%2Fcompress-payload/lists"}