(req, data, encoding)
| 44 | const kBufferCb = Symbol('kBufferCb'); |
| 45 | |
| 46 | function handleWriteReq(req, data, encoding) { |
| 47 | const { handle } = req; |
| 48 | |
| 49 | switch (encoding) { |
| 50 | case 'buffer': |
| 51 | { |
| 52 | const ret = handle.writeBuffer(req, data); |
| 53 | if (streamBaseState[kLastWriteWasAsync]) |
| 54 | req.buffer = data; |
| 55 | return ret; |
| 56 | } |
| 57 | case 'latin1': |
| 58 | case 'binary': |
| 59 | return handle.writeLatin1String(req, data); |
| 60 | case 'utf8': |
| 61 | case 'utf-8': |
| 62 | return handle.writeUtf8String(req, data); |
| 63 | case 'ascii': |
| 64 | return handle.writeAsciiString(req, data); |
| 65 | case 'ucs2': |
| 66 | case 'ucs-2': |
| 67 | case 'utf16le': |
| 68 | case 'utf-16le': |
| 69 | return handle.writeUcs2String(req, data); |
| 70 | default: |
| 71 | { |
| 72 | const buffer = Buffer.from(data, encoding); |
| 73 | const ret = handle.writeBuffer(req, buffer); |
| 74 | if (streamBaseState[kLastWriteWasAsync]) |
| 75 | req.buffer = buffer; |
| 76 | return ret; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | function onWriteComplete(status) { |
| 82 | debug('onWriteComplete', status, this.error); |
no test coverage detected
searching dependent graphs…