Skip to content

Commit

Permalink
Create token file using file name given as param (#8642)
Browse files Browse the repository at this point in the history
* Add await and change to asynchronous serialization
  • Loading branch information
praveenkuttappan authored Jul 16, 2024
1 parent ba0a084 commit 03aaf19
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ static async Task HandlePackageFileParsing(Stream stream, FileInfo packageFilePa
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};

{
using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write);
using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal);
JsonSerializer.Serialize(new Utf8JsonWriter(gZipStream, new JsonWriterOptions { Indented = false }), treeTokenCodeFile, options);
}

await using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write);
await using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal);
await JsonSerializer.SerializeAsync(gZipStream, treeTokenCodeFile, options);
Console.WriteLine($"TokenCodeFile File {gzipJsonTokenFilePath} Generated Successfully.");
Console.WriteLine();
}
Expand Down

0 comments on commit 03aaf19

Please sign in to comment.