import { Utf8 } from "@effect/core/stream/Stream/operations/_internal/bom" import { utf8DecodeNoBom } from "@effect/core/stream/Stream/operations/_internal/utf8DecodeNoBom" import { utfDecodeDetectingBom } from "@effect/core/stream/Stream/operations/_internal/utfDecodeDetectingBom" /** * @tsplus getter effect/core/stream/Stream utf8Decode */ export function utf8Decode( self: Stream ): Stream { return self.via( utfDecodeDetectingBom(3, (bom) => bom.corresponds(Utf8, (a, b) => a === b) ? [Chunk.empty(), utf8DecodeNoBom] : [bom, utf8DecodeNoBom]) ) }