MCPcopy Index your code
hub / github.com/anomalyco/opencode / createOutputDecoder

Function createOutputDecoder

packages/desktop/src/main/wsl/runtime.ts:175–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173}
174
175function createOutputDecoder() {
176 let decoder: TextDecoder | undefined
177 return {
178 decode(chunk: Buffer) {
179 decoder ??= new TextDecoder(detectOutputEncoding(chunk))
180 return decoder.decode(chunk, { stream: true })
181 },
182 flush() {
183 return decoder?.decode() ?? ""
184 },
185 }
186}
187
188function detectOutputEncoding(chunk: Uint8Array) {
189 if (chunk[0] === 0xff && chunk[1] === 0xfe) return "utf-16le"

Callers 1

runCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected