{"id":22508,"library":"ui-build-compression","title":"ui-build-compression","description":"A Rust-powered build compression tool that creates gzip, brotli, zstd, and deflate compressed file variants alongside originals for production UI deployments. Version 1.1.4 ships TypeScript definitions and supports both programmatic (Rust and Node.js) and CLI usage. Key differentiator: aggressively configured compression settings in Rust for maximum reduction, outperforming pure-JS compressors particularly for brotli and zstd. Suitable for build pipelines of static sites or SPAs.","status":"active","version":"1.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/alexfigliolia/ui-build-compression","tags":["javascript","brotli","build","compression","deflate","frontend","gzip","production","rust","typescript"],"install":[{"cmd":"npm install ui-build-compression","lang":"bash","label":"npm"},{"cmd":"yarn add ui-build-compression","lang":"bash","label":"yarn"},{"cmd":"pnpm add ui-build-compression","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a named export, not a default export. Also works with require('ui-build-compression').compress.","wrong":"import compress from 'ui-build-compression'","symbol":"compress","correct":"import { compress } from 'ui-build-compression'"},{"note":"CommonJS require returns an object; destructure to get the named export.","wrong":"const compress = require('ui-build-compression')","symbol":"compress","correct":"const { compress } = require('ui-build-compression')"},{"note":"TypeScript usage: same named import. Package includes type definitions.","wrong":"","symbol":"compress","correct":"import { compress } from 'ui-build-compression'"}],"quickstart":{"code":"import { compress } from 'ui-build-compression';\nimport path from 'path';\n\nconst buildDir = path.resolve('./dist');\ncompress(buildDir).then(() => {\n  console.log('Compression complete!');\n}).catch(err => {\n  console.error('Compression failed:', err);\n});","lang":"typescript","description":"Compresses all static files in the given directory using gzip, brotli, zstd, and deflate, generating .gz, .br, .zst, .zz alongside originals."},"warnings":[{"fix":"Always use await or attach .catch() to handle errors.","message":"The compress function is asynchronous and returns a Promise; omitting await or .catch() can lead to unhandled promise rejections.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Consider using a smaller subdirectory or exclude large binary files if needed. No built-in filter yet.","message":"The package compresses all files in the directory recursively. Large directories may take significant time due to aggressive compression settings.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Prefix with npx: npx ui-build-compression /path/to/dir","message":"The CLI command 'ui-build-compression' may conflict if a global package with the same name is installed. Always use npx or local scripts.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install ui-build-compression' or 'yarn add ui-build-compression'.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'ui-build-compression'"},{"fix":"Use named import: import { compress } from 'ui-build-compression'","cause":"Default import used instead of named import.","error":"TypeError: compress is not a function"},{"fix":"Provide an absolute path or ensure relative path is correct from process.cwd().","cause":"Provided path does not exist or is relative from wrong working directory.","error":"Error: ENOENT: no such file or directory, stat '/path/to/my/directory'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}