* Flush + close the file sink. Called on the success path after the * last write and on the error path inside a `.catch(() => undefined)` * so the original error isn't masked by a teardown failure. * * Re-raises any async stream error captured by the `'error'` listener. * Without this re-raise,
(sink: FileSink)
| 7831 | * exactly the failure mode `--out` exists to avoid. |
| 7832 | */ |
| 7833 | function closeOutputFile(sink: FileSink): Promise<void> { |
| 7834 | return new Promise((resolve, reject) => { |
| 7835 | sink.stream.end(() => { |
| 7836 | if (sink.error) { |
| 7837 | reject(new TransportError(`Failed to write --out ${sink.path}: ${sink.error.message}`)); |
| 7838 | return; |
| 7839 | } |
| 7840 | resolve(); |
| 7841 | }); |
| 7842 | }); |
| 7843 | } |
| 7844 | |
| 7845 | /** A presigned `code` body is any `https://` URL — never anything else. */ |
| 7846 | export function isPresignedCodeUrl(code: string): boolean { |