zfill Usage var zfill = require('zfill'); console.log(zfill(9, 2)); // prints '09'console.log(zfill(1234, 3)); // prints '1234'