/** * Effect `Stream` utilities for Frida. * * @since 1.0.0 */ import type * as ByteSize from "effect/ByteSize"; import type * as Duration from "effect/Duration"; import type * as Effect from "effect/Effect"; import type * as Function from "effect/Function"; import type * as Scope from "effect/Scope"; import type * as Stream from "effect/Stream"; import * as internal from "./internal/stream.ts"; /** * @since 1.0.0 * @category Types */ export interface FromInputStreamOptions { readonly chunkSize?: ByteSize.ByteSize | undefined; } /** * @since 1.0.0 * @category IPC */ export const receiveStream: ( shareOptions: | { readonly capacity: "unbounded"; readonly replay?: number | undefined; readonly idleTimeToLive?: Duration.Input | undefined; } | { readonly capacity: number; readonly strategy?: "sliding" | "dropping" | "suspend" | undefined; readonly replay?: number | undefined; readonly idleTimeToLive?: Duration.Input | undefined; } ) => Effect.Effect< Stream.Stream< { message: string; data?: Uint8Array | undefined; }, never, never >, never, Scope.Scope > = internal.receiveStream; /** * @since 1.0.0 * @category Constructors * @see https://frida.re/docs/javascript-api/#inputstream */ export const fromInputStream: ( evaluate: Function.LazyArg, onError: (error: unknown) => E, options?: FromInputStreamOptions | undefined ) => Stream.Stream = internal.fromInputStream; /** * @since 1.0.0 * @category Constructors * @see https://frida.re/docs/javascript-api/#unixinputstream */ export const makeUnixInputStream: ( fileDescriptor: number, onError: (error: unknown) => E, options?: (FromInputStreamOptions & UnixStreamOptions) | undefined ) => Stream.Stream = internal.makeUnixInputStream; /** * @since 1.0.0 * @category Constructors * @see https://frida.re/docs/javascript-api/#win32inputstream */ export const makeWin32InputStream: ( handle: NativePointerValue, onError: (error: unknown) => E, options?: (FromInputStreamOptions & WindowsStreamOptions) | undefined ) => Stream.Stream = internal.makeWin32InputStream; /** * @since 1.0.0 * @category Destructors * @see https://frida.re/docs/javascript-api/#inputstream */ export const toInputStream: (stream: Stream.Stream) => Effect.Effect = internal.toInputStream; /** * Like {@link toInputStream} but with `R` fixed to `never`. * * @since 1.0.0 * @category Destructors */ export const toInputStreamNever: (stream: Stream.Stream) => InputStream = internal.toInputStreamNever;