Skip to content

Instantly share code, notes, and snippets.

@serhiy-storchaka
Last active January 29, 2020 13:18
Show Gist options
  • Save serhiy-storchaka/22fbf90568f7f5fee32b2c2f331685ae to your computer and use it in GitHub Desktop.
Save serhiy-storchaka/22fbf90568f7f5fee32b2c2f331685ae to your computer and use it in GitHub Desktop.
Copy files using mmap
import sys, mmap
with open(sys.argv[1], 'rb') as src:
with open(sys.argv[2], 'wb') as dst:
mm = mmap.mmap(src.fileno(), 0, access=mmap.ACCESS_READ)
dst.write(mm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment