MCPcopy Create free account
hub / github.com/Effect-TS/effect / withScopeFinalizer

Function withScopeFinalizer

packages/effect/test/Stream.test.ts:139–150  ·  view source on GitHub ↗
(
      self: Stream.Stream<A, E, R>,
      finalizer: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<unknown>
    )

Source from the content-addressed store, hash-verified

137
138 describe("destructors", () => {
139 const withScopeFinalizer = <A, E, R>(
140 self: Stream.Stream<A, E, R>,
141 finalizer: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<unknown>
142 ): Stream.Stream<A, E, R> =>
143 Stream.fromChannel(
144 Channel.fromTransform((upstream, scope) =>
145 Effect.andThen(
146 Scope.addFinalizerExit(scope, finalizer),
147 Channel.toTransform(Stream.toChannel(self))(upstream, scope)
148 )
149 )
150 )
151
152 it.effect("mkArrayBuffer - concatenates Uint8Array chunks", () =>
153 Effect.gen(function*() {

Callers 1

Stream.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected