node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »



A Node.js module for converting numbers into pretty strings with suffixes to indicate scale (Kilo, Mega, Giga, etc.)


>var ns = require('numscale');
>var myThroughput = {value: 1000000000, powerOf: 10, maxLen: 5};

>var myCapacity = {value: 1073741824, powerOf: 2, maxLen: 5};

>var myCounter = {value: 654345443, powerOf: 10, maxLen: 6};

>var myMemory = {value: 43322466, powerOf: 2, maxLen: 7};


The scale() method takes an object argument. The members of the argument object are as follows:

  • value (required) - the number to be scaled and formatted
  • powerOf (optional) - either 2 or 10: sets scaling factor (defaults to 10)
  • maxLen (optional) - maximum length of the string to be returned (default 20)

'value' must be a non-negative positive integer within the safe JavaScript range.