
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
A file handle that groups subsequence writes together and periodically writes them as separate files. Useful for file systems like GCS FUSE that do not support file appending. Pathlib can be patched to replace files opened in append mode with chunked files, so external libraries need not be changed.
Using ChunkedFile
:
import time
import chunkedfile
# Write chunks up to every 10 minutes.
with chunkedfile.ChunkedFile('filename.txt', 600) as f:
# The first chunk will be written on the first write after the sleep.
f.write('Lorem\n')
time.sleep(1000)
f.write('Ipsum\n')
# The last chunk is automatically written when the file is closed.
f.write('Dolor\n')
f.write('Sit\n')
# The directory now contains two files:
# - filename.txt-1-20210904T130400
# - filename.txt-2-20210904T132100
Using pathlib.Path
:
import time
import pathlib
import chunkedfile
# Path objects opened in append mode will be replaced by chunked files.
chunkedfile.patch_pathlib_append(600)
# Write chunks up to every 10 minutes.
with pathlib.Path('filename.txt').open('a') as f:
# The first chunk will be written during the sleep command.
f.write('Lorem\n')
f.write('Ipsum\n')
time.sleep(1000)
# The last chunk is automatically written when the file is closed.
f.write('Dolor\n')
f.write('Sit\n')
# The directory now contains two files:
# - filename.txt-1-20210904T130400
# - filename.txt-2-20210904T132100
FAQs
Save file writes into multiple chunks.
We found that chunkedfile demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.