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

Function withScopeFinalizer

packages/effect/test/Stream.test.ts:160–171  ·  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

158
159 describe("destructors", () => {
160 const withScopeFinalizer = <A, E, R>(
161 self: Stream.Stream<A, E, R>,
162 finalizer: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<unknown>
163 ): Stream.Stream<A, E, R> =>
164 Stream.fromChannel(
165 Channel.fromTransform((upstream, scope) =>
166 Effect.andThen(
167 Scope.addFinalizerExit(scope, finalizer),
168 Channel.toTransform(Stream.toChannel(self))(upstream, scope)
169 )
170 )
171 )
172
173 it.effect("mkArrayBuffer - concatenates Uint8Array chunks", () =>
174 Effect.gen(function*() {

Callers 1

Stream.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected