public static CompletableFuture<Void> writeTo(StreamMessage<? extends HttpData> publisher,
                                                  Path destination, OpenOption... options) {
        requireNonNull(publisher, "publisher");
        requireNonNull(destination, "destination");
        requireNonNull(options, "options");

        final RequestContext ctx = RequestContext.currentOrNull();
        EventExecutor eventExecutor = null;
        ExecutorService blockingTaskExecutor = null;
        if (ctx != null) {
            eventExecutor = ctx.eventLoop();
            if (ctx instanceof ServiceRequestContext) {
                blockingTaskExecutor = ((ServiceRequestContext) ctx).blockingTaskExecutor();
            }
        }
        if (eventExecutor == null) {
            eventExecutor = CommonPools.workerGroup().next();
        }
        if (blockingTaskExecutor == null) {
            blockingTaskExecutor = CommonPools.blockingTaskExecutor();
        }

        return writeTo(publisher, destination, eventExecutor, blockingTaskExecutor, options);
    }
Writes the specified {@link StreamMessage} to the given {@link Path} with {@link OpenOption}s.
If the {@link OpenOption}s are not specified, they default to {@link StandardOpenOption#CREATE},
{@link StandardOpenOption#TRUNCATE_EXISTING} and {@link StandardOpenOption#WRITE}.

@param publisher the source of {@link HttpData} to be read from.
@param destination the {@link Path} to write to.
@param options the {@link OpenOption}s specifying how the file is opened.
@return a {@link CompletableFuture} that completes successfully when the {@link StreamMessage} is fully
        written to the {@link Path} or exceptionally an error occurred while writing the
        {@link StreamMessage}.
core/src/main/java/com/linecorp/armeria/common/stream/StreamMessages.java