Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Bson;
|
||||
|
||||
namespace adas_core.Domain.Utils;
|
||||
|
||||
public static class JsonExtensions
|
||||
{
|
||||
public static void CopyToBson(string inputPath, string outputPath, FileMode fileMode = FileMode.CreateNew)
|
||||
{
|
||||
using var textReader = File.OpenText(inputPath);
|
||||
using var jsonReader = new JsonTextReader(textReader);
|
||||
using var oFileStream = new FileStream(outputPath, fileMode);
|
||||
using var dataWriter = new BsonDataWriter(oFileStream);
|
||||
dataWriter.WriteToken(jsonReader);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user