You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

  1. # node-bytes
  2. Byte string parser / formatter.
  3. ## Example:
  4. ```js
  5. bytes('1kb')
  6. // => 1024
  7. bytes('2mb')
  8. // => 2097152
  9. bytes('1gb')
  10. // => 1073741824
  11. bytes(1073741824)
  12. // => 1gb
  13. ```
  14. ## Installation
  15. ```
  16. $ npm install bytes
  17. $ component install visionmedia/bytes.js
  18. ```
  19. ## License
  20. (The MIT License)
  21. Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
  22. Permission is hereby granted, free of charge, to any person obtaining
  23. a copy of this software and associated documentation files (the
  24. 'Software'), to deal in the Software without restriction, including
  25. without limitation the rights to use, copy, modify, merge, publish,
  26. distribute, sublicense, and/or sell copies of the Software, and to
  27. permit persons to whom the Software is furnished to do so, subject to
  28. the following conditions:
  29. The above copyright notice and this permission notice shall be
  30. included in all copies or substantial portions of the Software.
  31. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  32. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  33. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  34. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  35. CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  36. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  37. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.