Skip to content

Commit 69edcc9

Browse files
committed
RF: put gzip chunk constant into module global
Allows user to set max chunk size.
1 parent dee72f8 commit 69edcc9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nibabel/openers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
import gzip
1414
import bz2
1515

16+
# The largest memory chunk that gzip can use for reads
17+
GZIP_MAX_READ_CHUNK = 100 * 1024 * 1024 # 100Mb
18+
19+
1620
def _gzip_open(fileish, *args, **kwargs):
17-
# open gzip files with faster reads on large files using larger chuncks
21+
# open gzip files with faster reads on large files using larger chunks
22+
# See https://github.com/nipy/nibabel/pull/210 for discussion
1823
gzip_file = gzip.open(fileish, *args, **kwargs)
19-
gzip_file.max_read_chunk = 100 * 1024 * 1024 # 100Mb
24+
gzip_file.max_read_chunk = GZIP_MAX_READ_CHUNK
2025
return gzip_file
2126

2227

0 commit comments

Comments
 (0)