public override async Task <UploadItem> Execute(DataSourceFile dataSourceFile) { if (_storageClient == null || _storageClient.IsExpired) { _storageClient = await _storage.Renew(); } var file = dataSourceFile.Filename; var inputFile = _storageClient.IsCompressed ? await CompressFile(file, _storageClient.SourceCompression) : file; var encryptFile = await _storageClient.EncryptFile( inputFile, Path.GetTempFileName() ); var digest = FileHelpers.GetSha256Digest(inputFile); File.Delete(file); if (file != inputFile) { File.Delete(inputFile); } return(new UploadItem( storage: _storageClient, lifetimeKey: dataSourceFile.LifetimeKey, bucketKey: Path.GetFileName(file), digest: digest, filename: encryptFile )); }
public UploadItem(IPutFile storage, string lifetimeKey, string bucketKey, string digest, string filename) { Storage = storage; BucketKey = bucketKey; Digest = digest; Filename = filename; LifetimeKey = lifetimeKey; }