Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/saket/file-size

Unit for representing and converting between file sizes, inspired by kotlin.time.Duration
https://github.com/saket/file-size

Last synced: about 2 months ago
JSON representation

Unit for representing and converting between file sizes, inspired by kotlin.time.Duration

Awesome Lists containing this project

README

        

# file-size

```groovy
implementation "me.saket.filesize:filesize:1.2.0"
```

```kotlin
val cacheSize = 512.megabytes
println(cacheSize.toString()) // "512 MB"
println(cacheSize.inWholeBytes) // "512000000"
println(cacheSize + 88_000.kilobytes) // "600 MB"
println(cacheSize * 2) // "1.02 GB"
println(cacheSize < 1.gigabytes) // "true"
```