Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/saket/file-size
- Owner: saket
- License: apache-2.0
- Created: 2023-12-25T03:44:15.000Z (9 months ago)
- Default Branch: trunk
- Last Pushed: 2024-01-08T18:40:57.000Z (9 months ago)
- Last Synced: 2024-07-11T22:43:48.597Z (3 months ago)
- Language: Kotlin
- Homepage:
- Size: 181 KB
- Stars: 76
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-list - saket/file-size - Unit for representing and converting between file sizes, inspired by kotlin.time.Duration (Kotlin)
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"
```