UNPKG

1.42 kBtext/x-handlebars-templateView Raw
1[![view on npm](https://img.shields.io/npm/v/byte-size.svg)](https://www.npmjs.org/package/byte-size)
2[![npm module downloads](https://img.shields.io/npm/dt/byte-size.svg)](https://www.npmjs.org/package/byte-size)
3[![Build Status](https://travis-ci.org/75lb/byte-size.svg?branch=master)](https://travis-ci.org/75lb/byte-size)
4[![Coverage Status](https://coveralls.io/repos/github/75lb/byte-size/badge.svg?branch=master)](https://coveralls.io/github/75lb/byte-size?branch=master)
5[![Dependency Status](https://david-dm.org/75lb/byte-size.svg)](https://david-dm.org/75lb/byte-size)
6[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
7
8{{>main}}
9
10### Load anywhere
11
12This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
13
14Node.js:
15
16```js
17const byteSize = require('byte-size')
18```
19
20Within Node.js with ECMAScript Module support enabled:
21
22```js
23import byteSize from 'byte-size'
24```
25
26Within a modern browser ECMAScript Module:
27
28```js
29import byteSize from './node_modules/byte-size/index.mjs'
30```
31
32Old browser (adds `window.byteSize`):
33
34```html
35<script nomodule src="./node_modules/byte-size/dist/index.js"></script>
36```
37
38* * *
39
40&copy; 2014-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
41
\No newline at end of file