(buf, offset, length, position)
| 844 | // Used by writeSync for the full write, and by writevSync for |
| 845 | // completing a partial writev. |
| 846 | function writeSyncAll(buf, offset, length, position) { |
| 847 | let retries = 0; |
| 848 | while (length > 0) { |
| 849 | const ctx = {}; |
| 850 | const bytesWritten = binding.writeBuffer( |
| 851 | fd, buf, offset, length, position, undefined, ctx) || 0; |
| 852 | if (ctx.errno !== undefined) { |
| 853 | handleSyncErrorFromBinding(ctx); |
| 854 | } |
| 855 | if (bytesWritten === 0) { |
| 856 | if (++retries > 5) { |
| 857 | throw new ERR_OPERATION_FAILED('write failed after retries'); |
| 858 | } |
| 859 | } else { |
| 860 | retries = 0; |
| 861 | } |
| 862 | totalBytesWritten += bytesWritten; |
| 863 | offset += bytesWritten; |
| 864 | length -= bytesWritten; |
| 865 | if (position >= 0) position += bytesWritten; |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | async function cleanup() { |
| 870 | if (closed) return; |
no outgoing calls
no test coverage detected
searching dependent graphs…