( writable: Writable | NodeJS.WritableStream, encoding?: BufferEncoding )
| 227 | |
| 228 | /** @internal */ |
| 229 | export const writeEffect = <A>( |
| 230 | writable: Writable | NodeJS.WritableStream, |
| 231 | encoding?: BufferEncoding |
| 232 | ) => |
| 233 | (chunk: Chunk.Chunk<A>) => |
| 234 | chunk.length === 0 ? |
| 235 | Effect.void : |
| 236 | Effect.async<void>((resume) => { |
| 237 | const iterator = chunk[Symbol.iterator]() |
| 238 | let next = iterator.next() |
| 239 | function loop() { |
| 240 | const item = next |
| 241 | next = iterator.next() |
| 242 | const success = writable.write(item.value, encoding as any) |
| 243 | if (next.done) { |
| 244 | resume(Effect.void) |
| 245 | } else if (success) { |
| 246 | loop() |
| 247 | } else { |
| 248 | writable.once("drain", loop) |
| 249 | } |
| 250 | } |
| 251 | loop() |
| 252 | }) |
| 253 | |
| 254 | const unsafeReadableRead = <A, E>( |
| 255 | readable: Readable | NodeJS.ReadableStream, |
no test coverage detected