{"id":41960,"library":"si-prefix","title":"si-prefix","description":"si-prefix v0.2.0 is a JavaScript library for converting numeric values into human-readable strings with SI or IEC prefixes (e.g., '35 mm', '2 KiB'). It wraps the si-prefix library for Node.js, offering basic formatting via si-prefix. Works with custom units and scales. Last updated 2021, no recent releases; minimal dependencies.","status":"maintenance","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/mal/si-prefix","tags":["javascript","SI prefix","human readable","binary","SI","IEC","yocto","zepto","atto"],"install":[{"cmd":"npm install si-prefix","lang":"bash","label":"npm"},{"cmd":"yarn add si-prefix","lang":"bash","label":"yarn"},{"cmd":"pnpm add si-prefix","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default import; CJS require also works.","wrong":"const si = require('si-prefix')","symbol":"default (si)","correct":"import si from 'si-prefix'"},{"note":"Named export for Unit class.","wrong":"const Unit = require('si-prefix').Unit","symbol":"Unit","correct":"import { Unit } from 'si-prefix'"},{"note":"Named export for Scale class.","symbol":"Scale","correct":"import { Scale } from 'si-prefix'"}],"quickstart":{"code":"import si from 'si-prefix';\n\n// Basic formatting\nconsole.log(si.metre.format(0.035, ' ')); // '35 mm'\nconsole.log(si.kilogram.suffix(0.00000000094, ' ')); // 'ng'\nconsole.log(si.byte.convert(2048)); // [2, 'KiB']\nconsole.log(si.byte.decimal.convert(2048)); // [2.048, 'kB']\n\n// Custom unit\nconst { Scale, Unit } = si;\nconst scale = new Scale({ minor: true });\nconst unit = new Unit(scale, 'm');\nconsole.log(unit.format(0.03, ' ')); // '3 cm'","lang":"javascript","description":"Demonstrates basic formatting with SI base units (metre, kilogram, byte) and custom unit creation with Scale and Unit."},"warnings":[{"fix":"Use si.kilogram.suffix(value) for grams, or create a custom gram unit.","message":"kilogram is base unit; gram is not directly available as si.gram.","severity":"gotcha","affected_versions":"*"},{"fix":"Access si.byte.decimal for SI prefixes (kB, MB).","message":"byte uses IEC binary prefixes (KiB, MiB, etc.) by default; use byte.decimal for SI prefixes.","severity":"gotcha","affected_versions":"*"},{"fix":"Use Scale({minor: true}) to include these prefixes.","message":"Separate flags for hecto/deca/deci/centi not implemented yet.","severity":"deprecated","affected_versions":"0.2.0"}],"env_vars":null,"search_vec":"'2':29 '2021':55 '35':27 'atto':71 'basic':41 'binari':66 'convert':13 'custom':49 'depend':60 'e.g':26 'format':42 'human':18,64 'human-read':17 'iec':24,68 'javascript':10,61 'kib':30 'last':53 'librari':11,37 'minim':59 'mm':28 'node.js':39 'numer':14 'offer':40 'prefix':3,6,25,36,46,63 'readabl':19,65 'recent':57 'releas':58 'scale':52 'si':2,5,22,35,45,62,67 'si-prefix':1,4,34,44 'string':20 'unit':50 'updat':54 'v0.2.0':7 'valu':15 'via':43 'work':47 'wrap':32 'yocto':69 'zepto':70","created_at":"2026-06-04T18:54:56.711194+00:00","updated_at":"2026-06-04T18:54:56.711194+00:00","problems":[{"fix":"Run 'npm install si-prefix' and ensure package.json has it.","cause":"Missing dependency or incorrect import path.","error":"Uncaught ReferenceError: Module not found: Can't resolve 'si-prefix'"},{"fix":"Run 'npm install si-prefix'.","cause":"Package not installed in node_modules.","error":"Cannot find module 'si-prefix'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mal/si-prefix#readme","github":"https://github.com/mal/si-prefix","docs":null,"changelog":null,"pypi":null,"npm":"si-prefix","openapi_spec":null,"status_page":null,"smithery":null,"categories":["productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}