xref: /aosp_15_r20/external/okio/docs/multiplatform.md (revision f9742813c14b702d71392179818a9e591da8620c)
1Multiplatform
2=============
3
4Okio is a [Kotlin Multiplatform][kotlin_multiplatform] project. We're still completing our feature
5coverage.
6
7
8### Compression (Deflater, Inflater, Gzip)
9
10JVM-only.
11
12
13### Concurrency (Pipe, Timeouts, Throttler)
14
15JVM-only.
16
17Timeout is on all platforms, but only the JVM has a useful implementation.
18
19
20### Core (Buffer, ByteString, Source, Sink)
21
22Available on all platforms.
23
24
25### File System
26
27Available on all platforms. For JavaScript this requires [Node.js][node_js].
28
29
30### Hashing
31
32Okio includes Kotlin implementations of MD5, SHA-1, SHA-256, and SHA-512. This includes both hash
33functions and HMAC functions.
34
35Okio uses the built-in implementations of these functions on the JVM.
36
37
38[kotlin_multiplatform]: https://kotlinlang.org/docs/reference/multiplatform.html
39[mingw]: http://www.mingw.org/
40[node_js]: https://nodejs.org/api/fs.html
41
42## Gradle configuration
43
44```kotlin
45// build.gradle.kts
46kotlin {
47    sourceSets {
48        val okioVersion = "3.XXX"
49        val commonMain by getting {
50            dependencies {
51                implementation("com.squareup.okio:okio:$okioVersion")
52            }
53        }
54        val jsMain by getting {
55            dependencies {
56                implementation("com.squareup.okio:okio-nodefilesystem:$okioVersion")
57            }
58        }
59        val commonTest by getting {
60            dependencies {
61                implementation("com.squareup.okio:okio-fakefilesystem:$okioVersion")
62            }
63        }
64    }
65}
66```
67