Example #1
0
        public async Task <Dictionary <string, StatusResult> > UploadAsync(IArchiveType archiveType, IEnumerable <byte> bytes)
        {
            var stream = _innerClient.Upload();
            var chunks = bytes
                         .Batch(1024 * 1024)
                         .Select(x => x.ToArray());
            await stream.RequestStream.WriteAllAsync(
                chunks.Select(x => new Chunk
            {
                Data   = ByteString.CopyFrom(x),
                Format = new Archiver {
                    Format = archiveType.Format, Type = archiveType.Type
                }
            })
                );

            var response = await stream.ResponseAsync;

            return(response.Entry.ToDictionary());
        }