mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 09:27:29 +00:00
22 lines
727 B
Swift
22 lines
727 B
Swift
import ExpoModulesCore
|
|
|
|
// Sync avoids a thread hop when reading Uint8Array; each window takes only a few ms.
|
|
public class OrcaGzipUtf8CodecModule: Module {
|
|
public func definition() -> ModuleDefinition {
|
|
Name("OrcaGzipUtf8Codec")
|
|
|
|
Function("gunzip") { (input: Data, outputLimit: Int) throws -> Data in
|
|
try gunzipBounded(input, outputLimit: outputLimit)
|
|
}
|
|
|
|
Function("decodeUtf8") { (input: Data) -> String? in
|
|
decodeStrictUtf8(input)
|
|
}
|
|
|
|
// Async: a whole bundle asset can take tens of ms, too long to hold the JS thread.
|
|
AsyncFunction("brotliDecompress") { (input: Data, outputLimit: Int) throws -> Data in
|
|
try brotliDecompressBounded(input, outputLimit: outputLimit)
|
|
}
|
|
}
|
|
}
|