Skip to content

Commit

Permalink
Add example of buffered copy
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Jun 19, 2024
1 parent 1ab853a commit 1866853
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/comparison.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ S3Path Example:
>>> local_path = Path('/tmp/hello.txt')
>>> S3Path('/my-bucket/hello.txt').write_text(local_path.read_text())
S3Path Example (buffered, to avoid loading large files into memory):

.. code:: python
>>> import shutil
>>> from pathlib import Path
>>> from s3path import S3Path
>>> local_path = Path('/tmp/hello.txt')
>>> remote_path = S3Path('/my-bucket/hello.txt')
>>> with local_path.open('rb') as src, remote_path.open('wb') as dst:
>>> shutil.copyfileobj(src, dst)
boto3 Example:

.. code:: python
Expand Down

0 comments on commit 1866853

Please sign in to comment.