Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saveourtool/okio-extras
A set of extensions to Okio, check out https://saveourtool.github.io/okio-extras/
https://github.com/saveourtool/okio-extras
io kotlin-multiplatform kotlin-multiplatform-library library okio
Last synced: 3 months ago
JSON representation
A set of extensions to Okio, check out https://saveourtool.github.io/okio-extras/
- Host: GitHub
- URL: https://github.com/saveourtool/okio-extras
- Owner: saveourtool
- License: mit
- Created: 2023-02-21T15:28:26.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-31T10:39:25.000Z (6 months ago)
- Last Synced: 2024-07-31T11:57:04.552Z (6 months ago)
- Topics: io, kotlin-multiplatform, kotlin-multiplatform-library, library, okio
- Language: Kotlin
- Homepage: https://saveourtool.github.io/okio-extras/
- Size: 634 KB
- Stars: 11
- Watchers: 5
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
= okio-extras
:toc:[.float-group]
--
[.left]
image::https://img.shields.io/badge/License-MIT-yellow.svg[License: MIT,link="https://opensource.org/licenses/MIT"][.left]
image::https://github.com/saveourtool/okio-extras/actions/workflows/build.yml/badge.svg?branch=master[,link="https://github.com/saveourtool/okio-extras/actions/workflows/build.yml?query=branch%3Amaster"][.left]
image::https://badgen.net/github/release/saveourtool/okio-extras/latest?color=green[GitHub release,link=https://github.com/saveourtool/okio-extras/releases/latest]
--A set of extensions to https://square.github.io/okio/[_Okio_].
See the https://saveourtool.github.io/okio-extras[project website] for
documentation and APIs.== Features
Among other useful multiplatform extensions, which are modelled after `kotlin.io`
API available on the JVM, the library provides a way to convert a file system
path to a `file://` URI and vice versa:[source,kotlin]
----
// Will print "file:/C:/Windows/"
println("C:\\Windows".toPath().toFileUri())// Will print "C:\Program Files"
println(Uri("file:///C:/Program%20Files").toLocalPath().pathString)
----UNC paths are supported on _Windows_:
[source,kotlin]
----
// Will print "\\127.0.0.1\C$\Windows"
println(Uri("file:////127.0.0.1/C$/Windows").toLocalPath().pathString)// Will print "\\WSL$\Debian\etc\passwd"
println(Uri("file:////WSL$/Debian/etc/passwd").toLocalPath().pathString)
----IPv6 addresses are parsed correctly:
[source,kotlin]
----
// Will print "\\--1.ipv6-literal.net\C$\Windows"
println(Uri("file://[::1]/C$/Windows").toLocalPath().pathString)
----== Releases
The latest release is available from _GitHub Packages_.
For `build.gradle.kts`:
[source,kotlin]
----
repositories {
maven {
name = "saveourtool/okio-extras"
url = uri("https://maven.pkg.github.com/saveourtool/okio-extras")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
----For `settings.gradle.kts`:
[source,kotlin]
----
dependencyResolutionManagement {
repositories {
maven {
name = "saveourtool/okio-extras"
url = uri("https://maven.pkg.github.com/saveourtool/okio-extras")
credentials {
username = providers.gradleProperty("gpr.user").orNull
?: System.getenv("GITHUB_ACTOR")
password = providers.gradleProperty("gpr.key").orNull
?: System.getenv("GITHUB_TOKEN")
}
}
}
}
----Then add the dependency as usual:
[source,kotlin]
----
dependencies {
implementation("com.saveourtool:okio-extras:1.1.1")
}
----