MCPcopy
hub / github.com/aws/aws-cli / _gzip_compress_fileobj

Function _gzip_compress_fileobj

awscli/botocore/compress.py:106–117  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

104
105
106def _gzip_compress_fileobj(body):
107 compressed_obj = io.BytesIO()
108 with GzipFile(fileobj=compressed_obj, mode='wb') as gz:
109 while True:
110 chunk = body.read(8192)
111 if not chunk:
112 break
113 if isinstance(chunk, str):
114 chunk = chunk.encode('utf-8')
115 gz.write(chunk)
116 compressed_obj.seek(0)
117 return compressed_obj
118
119
120def _set_compression_header(headers, encoding):

Callers 1

_gzip_compress_bodyFunction · 0.85

Calls 4

readMethod · 0.45
encodeMethod · 0.45
writeMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected