From 00f92cf9039079af1ddfe802cf707989108650b5 Mon Sep 17 00:00:00 2001 From: Marcel <14852157+Marcel0024@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:53:45 +0200 Subject: [PATCH] Use AppendLines instead AppendText --- CocoCrawler/CrawlOutputs/CsvFileCrawlOutput.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CocoCrawler/CrawlOutputs/CsvFileCrawlOutput.cs b/CocoCrawler/CrawlOutputs/CsvFileCrawlOutput.cs index dcdd10a..4902dc4 100644 --- a/CocoCrawler/CrawlOutputs/CsvFileCrawlOutput.cs +++ b/CocoCrawler/CrawlOutputs/CsvFileCrawlOutput.cs @@ -32,14 +32,14 @@ public virtual async Task WriteAsync(JObject jObject, CancellationToken cancella try { - // Add headers + // Add headers if new file if (!File.Exists(filePath)) { var headers = string.Join(",", jObject.Properties().Select(p => p.Name)); - await File.WriteAllTextAsync(filePath, headers + Environment.NewLine, cancellationToken); + await File.AppendAllLinesAsync(filePath, [headers], cancellationToken); } - await File.AppendAllTextAsync(filePath, csv + Environment.NewLine, cancellationToken); + await File.AppendAllLinesAsync(filePath, [csv], cancellationToken); } finally {