Skip to content

Instantly share code, notes, and snippets.

@mattiasostmar
mattiasostmar / chunker.py
Last active September 16, 2018 13:53
A slight moderation to get the code working on http://bdurblg.blogspot.se/2011/06/python-split-any-file-binary-to.html (darn, need to get those indentations right...)
# define the function to split the file into smaller chunks
def splitFile(inputFile,chunkSize):
#read the contents of the file
f = open(inputFile, 'rb')
data = f.read()
f.close()
# get the length of data, ie size of the input file in bytes
bytes = len(data)