(chunks)
| 974 | }, |
| 975 | |
| 976 | writevSync(chunks) { |
| 977 | if (error || closed || asyncPending) return false; |
| 978 | chunks = newStreamsConvertChunks(chunks); |
| 979 | let totalSize = 0; |
| 980 | for (let i = 0; i < chunks.length; i++) { |
| 981 | totalSize += chunks[i].byteLength; |
| 982 | } |
| 983 | if (totalSize > syncWriteThreshold) return false; |
| 984 | if (totalSize === 0) return true; |
| 985 | if (bytesRemaining >= 0 && totalSize > bytesRemaining) return false; |
| 986 | const position = pos; |
| 987 | // writeBuffers throws on error (zero bytes written) - safe |
| 988 | // to catch and return false for async fallback. |
| 989 | let bytesWritten; |
| 990 | try { |
| 991 | bytesWritten = binding.writeBuffers(fd, chunks, position) || 0; |
| 992 | } catch { |
| 993 | return false; |
| 994 | } |
| 995 | totalBytesWritten += bytesWritten; |
| 996 | if (position >= 0) { |
| 997 | pos = position + bytesWritten; |
| 998 | } |
| 999 | if (bytesWritten === totalSize) { |
| 1000 | if (bytesRemaining > 0) bytesRemaining -= totalSize; |
| 1001 | return true; |
| 1002 | } |
| 1003 | // Partial writev - bytes are on disk. Must complete or throw. |
| 1004 | const rest = Buffer.concat(chunks); |
| 1005 | writeSyncAll(rest, bytesWritten, |
| 1006 | rest.byteLength - bytesWritten, |
| 1007 | position >= 0 ? position + bytesWritten : -1); |
| 1008 | if (bytesRemaining > 0) bytesRemaining -= totalSize; |
| 1009 | return true; |
| 1010 | }, |
| 1011 | |
| 1012 | end(options = kNullPrototo) { |
| 1013 | if (error) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…