Compressing natural numbers with PoliDataCompressor.js
Jan 9 · 2 min read

The PoliDataCompressor library is very simple and easy to use. It has been fully developed in JavaScript and facilitates deploy on websites and cross-platform development for smartphone applications.
Today we will talk about how to compress natural numbers, in other words, those that are not negative. You can use these functions to compact ages, sequences, telephones, internal codes, documents that only have numbers.


Well, to facilitate our learning, open in Google Chrome and right-click choose the last menu option that should be “Inspect” or if you prefer use the shortcut CTRL + SHIFT + I.
A window like the image below will appear.

If you are not in the “Console” option, navigate through the options until you find it.

Compacting natural numbers

To compress natural integers we must use the NCOMP (Numeric Compressor) command, see how simple it is to compact the number 65535.
NCOMP (65535)

The result is two bytes represented by 255, 255.
So if your DAPP or SMART CONTRACT were to store FIVE positions in Blockchain, it would only spend TWO.

Decompressing natural numbers

To decompress natural integers you must use the NDECOMP command (Numeric DECOMPressor).
For us, the command used would be NDECOMP ([255, 255]), see:

Caution: The maximum limit of the compression function NCOMP is a sequence of fifteen numeric characters.

How to deploy the library in your web application

To deploy just download the .ZIP file on the site itself, unzip and reference the files in the <HEAD> of your HTML page.

<script src=""></script>
<script src=”PoliDataCompressor.js”></script>
<script src=”PoliDataCompressor-util.js”></script>

You must to reference the JQuery library too.

About the license

Don’t worry about the license if your application stay in testing; but if this give to you opportunity to save money, you should contact us and negotiate a license for use.

Thanks for reading

Poli, Marcus

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade