On this page
  1. shutil.copyfileobj
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

shutil.copyfileobj

Prev: shutil.copyfile | Up: shutil | Next: shutil.copymode
Rel: shutil.chown, shutil.copy, shutil.copy2, shutil.copyfile
Ref: docs.python.org — shutil.copyfileobj
Tags: #public #python3 #stdlib #shutil


Import

import shutil
from shutil import copyfileobj

Signature & Overview

shutil.copyfileobj(fsrc, fdst, length=0)

copy data from file-like object fsrc to file-like object fdst

Usage

import io
import shutil

src = io.BytesIO(b"streaming payload")
dst = io.BytesIO()
shutil.copyfileobj(src, dst, length=1024)
assert dst.getvalue() == b"streaming payload"

Gotchas

REPL Inspect

from shutil import copyfileobj
help(copyfileobj)

Linked from

Related notes