public async Task <IFileInformation> CopyFileToSameServiceType(string identifier, IStorageService destinationService) { var destination = (GoogleStorageService)destinationService; var uniqueName = Guid.NewGuid().ToString(); await _googleClient.CopyObjectAsync(GoogleSettings.Bucket, identifier, destinationBucket : destination.GoogleSettings.Bucket, destinationObjectName : uniqueName); var info = new GoogleFileInformation { StorageIdentifier = uniqueName }; return(info); }
public async Task <IFileInformation> StoreFile(Stream fileStream) { var uniqueName = Guid.NewGuid().ToString(); // try // { // uniqueName = uniqueName.ApplyExtension(name, contentType); // } // catch (Exception ex) // { // _logger.LogWarning(ex.Message); // } var uploadOptions = new UploadObjectOptions { ChunkSize = CHUNK_SIZE }; await _googleClient.UploadObjectAsync(GoogleSettings.Bucket, uniqueName, "application/octet-stream", fileStream, uploadOptions); var info = new GoogleFileInformation { StorageIdentifier = uniqueName }; return(info); }