This is natively supported by Intl.NumberFormat now and can be integrated with libraries like format.js
console.log(Intl.NumberFormat('en', {
maximumSignificantDigits: 3,
notation: 'compact',
style: 'unit',
unit: 'byte',
unitDisplay: 'narrow'
}).format(1050000));