private static void WriteLogs()

in src/Azure.AppService.Tunnel/LogsHandler.ashx.cs [30:42]


    private static void WriteLogs(HttpContext context, string logsFolder)
    {
        context.Response.ContentType = "application/zip";
        context.Response.AddHeader("Content-Disposition", "attachment; filename=logs.zip");

        // Response.Output stream is not seekable, but ZipArchive tries to seek when creating entries
        using var memoryStream = new MemoryStream();
        using var zipStream = new ZipArchive(memoryStream, ZipArchiveMode.Create);
        zipStream.CreateEntryFromDirectory(logsFolder);

        memoryStream.Seek(0, SeekOrigin.Begin);
        memoryStream.CopyTo(context.Response.OutputStream);
    }