示例#1
0
        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);
            }
        }
示例#2
0
        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));
            }
        }