示例#1
0
 public static async Task PutLocalFile(this IFileStoreService fileStoreService, string bucketName, string fileKey, string localFilePath)
 {
     using (var fileStream = new FileStream(localFilePath, FileMode.Open))
     {
         await fileStoreService.PutStream(bucketName, fileKey, fileStream);
     }
 }
示例#2
0
 public static async Task PutContent(this IFileStoreService fileStoreService, string bucketName, string fileKey, string content)
 {
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(content ?? string.Empty)))
     {
         stream.Seek(0, SeekOrigin.Begin);
         await fileStoreService.PutStream(bucketName, fileKey, stream);
     }
 }
示例#3
0
        public static async Task PutJsonObject <T>(this IFileStoreService fileStoreService, string bucketName, string fileKey, T objectToStore)
        {
            using (var stream = new MemoryStream())
            {
                await JsonSerializer.SerializeAsync(stream, objectToStore);

                stream.Seek(0, SeekOrigin.Begin);
                await fileStoreService.PutStream(bucketName, fileKey, stream);
            }
        }