prettier-bytes

WebJar for prettier-bytes

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

prettier-bytes
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

prettier-bytes
WebJar for prettier-bytes
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Flet/prettier-bytes

Download prettier-bytes

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/prettier-bytes/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>prettier-bytes</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/prettier-bytes/
implementation 'org.webjars.npm:prettier-bytes:1.0.4'
// https://jarcasting.com/artifacts/org.webjars.npm/prettier-bytes/
implementation ("org.webjars.npm:prettier-bytes:1.0.4")
'org.webjars.npm:prettier-bytes:jar:1.0.4'
<dependency org="org.webjars.npm" name="prettier-bytes" rev="1.0.4">
  <artifact name="prettier-bytes" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='prettier-bytes', version='1.0.4')
)
libraryDependencies += "org.webjars.npm" % "prettier-bytes" % "1.0.4"
[org.webjars.npm/prettier-bytes "1.0.4"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

prettier-bytes

npm travis standard

Augment pretty-bytes to make the output a little more readable (and a little less precise)

Differences from pretty-bytes:

  • The fractional portion is rounded to one digit (ex: 2.1 MB).
  • If there is more than one digit to the left of the decimal, the fractional portion is rounded off (ex: 11 KB).
  • Changed kB to KB, for more prettiness. Regular users are not likely to care about the technical difference.
  • No dependencies.

Install

npm install prettier-bytes

Usage

var prettierBytes = require('prettier-bytes')

var pretty = prettierBytes(1337)
console.log(pretty)
// logs 1.3 KB

Examples from test output:

    ✔ bytes: 2 -> 2 B
    ✔ bytes: 9 -> 9 B
    ✔ bytes: 25 -> 25 B
    ✔ bytes: 235 -> 235 B
    ✔ bytes: 2335 -> 2.3 KB
    ✔ bytes: 23552 -> 24 KB
    ✔ bytes: 235520 -> 236 KB
    ✔ bytes: 2355520 -> 2.4 MB
    ✔ bytes: 23555520 -> 24 MB
    ✔ bytes: 235555520 -> 236 MB
    ✔ bytes: 2355555520 -> 2.4 GB
    ✔ bytes: 23555555520 -> 24 GB
    ✔ bytes: 235556555520 -> 236 GB
    ✔ bytes: 2355556655520 -> 2.4 TB
    ✔ bytes: 23555566655520 -> 24 TB
    ✔ bytes: 235555566665520 -> 236 TB

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC

Versions

Version
1.0.4