public override void Store()

in dotnet/Utils/RichPath.cs [169:199]


        public override void Store(object data)
        {
            using (var outStream = new FileStream(Path, FileMode.Create))
            {
                string normalizedPath;
                Stream possiblyCompressedStream;
                if (Path.EndsWith(".gz"))
                {
                    normalizedPath = Path.Substring(0, Path.Length - 3); // Remove the ".gz"
                    possiblyCompressedStream = new GZipStream(outStream, CompressionMode.Compress);
                }
                else
                {
                    normalizedPath = Path;
                    possiblyCompressedStream = outStream;
                }

                if (normalizedPath.EndsWith(".json"))
                {
                    StoreAsJSON(possiblyCompressedStream, data, jsonl: false);
                }
                else if (normalizedPath.EndsWith(".jsonl"))
                {
                    StoreAsJSON(possiblyCompressedStream, data, jsonl: true);
                }
                else
                {
                    throw new ArgumentException($"File suffix must be .json[.gz] or .jsonl[.gz], but got {Path}");
                }
            }
        }