public static MongoGridFSFileInfo UploadFileWithCompress(this IMongoRepository repository, ICompressor compressor, byte[] data, string remoteFilename) { compressor.ShouldNotBeNull("compressor"); var entry = new CompressedFileItem(compressor.GetType(), compressor.Compress(data)); using(var stream = new MemoryStream(FileSerializer.Serialize(entry))) { return repository.UploadFile(remoteFilename, stream); } }
public static MongoGridFSFileInfo UploadFileWithCompress(this IMongoRepository repository, ICompressor compressor, byte[] data, string remoteFilename) { compressor.ShouldNotBeNull("compressor"); var entry = new CompressedFileItem(compressor.GetType(), compressor.Compress(data)); using (var stream = new MemoryStream(FileSerializer.Serialize(entry))) { return(repository.UploadFile(remoteFilename, stream)); } }