export async function flushWritableStreams(streams: readonly NodeJS.WritableStream[]): Promise<void> {
  await Promise.all(streams.map((stream) => new Promise<void>((resolve) => {
    try {
      stream.write("", () => resolve());
    } catch {
      resolve();
    }
  })));
}
