示例#1
0
        protected override async Task <Stream> GetStream(string path)
        {
            var obj = new MemoryStream();
            await _client.DownloadObjectAsync(path, obj);

            obj.Position = 0;
            return(obj);
        }
示例#2
0
        public async Task download_objects()
        {
            var fileName = Guid.NewGuid().ToString();

            using (var client = new RavenGoogleCloudClient(GoogleCloudFact.GoogleCloudSettings))
            {
                try
                {
                    await client.UploadObjectAsync(
                        fileName,
                        new MemoryStream(Encoding.UTF8.GetBytes("123"))
                        );

                    var file = new MemoryStream();
                    await client.DownloadObjectAsync(fileName, file);

                    Assert.Equal("123", Encoding.ASCII.GetString(file.ToArray()));
                }

                finally
                {
                    await client.DeleteObjectAsync(fileName);
                }
            }
        }
示例#3
0
        protected override async Task <ZipArchive> GetZipArchive(string filePath)
        {
            var file = new MemoryStream();
            await _client.DownloadObjectAsync(filePath, file);

            return(new ZipArchive(file, ZipArchiveMode.Read));
        }