Nenhuma descrição

cli.js 568B

123456789101112131415161718192021
  1. #!/usr/bin/env node
  2. 'use strict';
  3. var prettyBytes = require('./pretty-bytes');
  4. var input = process.argv.slice(2);
  5. if (!input || process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) {
  6. console.log('');
  7. console.log('pretty-bytes <number>');
  8. console.log('');
  9. console.log('Example:');
  10. console.log(' $ pretty-bytes 1337');
  11. console.log(' 1.34 kB');
  12. return;
  13. }
  14. if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) {
  15. console.log(require('./package').version);
  16. return;
  17. }
  18. console.log(prettyBytes(Number(input)));