(chunk, controller)
| 983 | } |
| 984 | |
| 985 | function doWrite(chunk, controller) { |
| 986 | const promise = PromiseWithResolvers(); |
| 987 | let ret; |
| 988 | let req; |
| 989 | try { |
| 990 | req = createWriteWrap(controller, promise); |
| 991 | ret = streamBase.writeBuffer(req, chunk); |
| 992 | if (streamBaseState[kLastWriteWasAsync]) |
| 993 | req.buffer = chunk; |
| 994 | req.async = !!streamBaseState[kLastWriteWasAsync]; |
| 995 | } catch (error) { |
| 996 | promise.reject(error); |
| 997 | } |
| 998 | |
| 999 | if (ret !== 0) |
| 1000 | promise.reject(new ErrnoException(ret, 'write', req)); |
| 1001 | else if (!req.async) |
| 1002 | promise.resolve(); |
| 1003 | |
| 1004 | return promise.promise; |
| 1005 | } |
| 1006 | |
| 1007 | return new WritableStream({ |
| 1008 | write(chunk, controller) { |
no test coverage detected
searching dependent graphs…