public async Task WriteAsync(Stream inputStream, string name) { try { var outputPath = _layout.GetPath(name); using (var outputStream = File.Create(outputPath.FullName)) { using (var writer = new StreamWriter(outputStream)) { await inputStream.CopyToAsync(outputStream); await writer.FlushAsync(); } } } catch (Exception exception) { Trace.TraceError(exception.Message); } }
public async Task WriteAsync(IDocument document, string name) { try { var outputPath = _layout.GetPath(name); var formatter = new MinifyMarkupFormatter(); using (var outputStream = File.Create(outputPath.FullName)) { using (var writer = new StreamWriter(outputStream)) { document.ToHtml(writer, formatter); await writer.FlushAsync(); } } } catch (Exception exception) { Trace.TraceError(exception.Message); } }