Stream files to AWS S3 using multipart upload.
Project description
Overview
A frontend module to upload files to AWS S3 storage. The module supports large files as it chunks them into smaller sizes and recombines them into the original file in the specified S3 bucket. It employs multiprocessing, and there is the option of specifying the size of each chunk as well as how many chunks to send in a single run. The defaults are listed in Optional Arguments below.
Prerequisites
An AWS S3 bucket to receive uploads.
An AWS Lambda function to perform backend tasks.
The AWS CloudFormation template to create these resources are available in the project’s GitHub repository.
Required (Positional) Arguments
Position 1: Filename (local full / relative path to the file)
Optional (Keyword) Arguments
path: Destination path in the S3 bucket (default: /)
parts: Number of multiprocessing parts to send simultaneously (default: 5)
partsize: Size of each part in MB (default: 100)
tmp: Location of local temporary directory to store temporary files created by the module (default: ‘/tmp’)
purge: Whether to purge the specified file instead of uploading it (default: False)
requrl: The endpoint URL for backend Lambda function (default: ‘https://<api_endpoint_url>’)
reqapikey: The API key for backend Lambda function (default: ‘<api_key>’)
Usage
Installation:
pip3 install s3streamer
# or
python3 -m pip install s3streamer
In Python3:
# To upload a new file.
from s3streamer.s3streamer import multipart
response = multipart(
'myfile.iso',
'installer/images'
)
# To remove a file from S3.
from s3streamer.s3streamer import multipart
response = multipart(
'myfile.iso',
'installer/images',
purge = True
)
In BASH:
# To upload a new file.
python3 -c \
"from s3streamer.s3streamer import multipart; \
response = multipart(\
'myfile.iso', \
'installer/images')"
# To remove a file from S3.
python3 -c \
"from s3streamer.s3streamer import multipart; \
response = multipart(\
'myfile.iso', \
'installer/images', \
purge = True)"
If the upload is successful, the file will be available at installer/images/myfile.iso.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file s3streamer-2024.1.0.0.tar.gz
.
File metadata
- Download URL: s3streamer-2024.1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.4.109+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 457afeb3470c4ed8c6a91c82ebbac4a33eaf210e81374eeecb223ad491b163cf |
|
MD5 | cb16ce393812feb3f3105bd6f4f91f05 |
|
BLAKE2b-256 | 871d70422c45541c7ca2067cd3d9e62719757315f8b773506be39a865898047b |
File details
Details for the file s3streamer-2024.1.0.0-py3-none-any.whl
.
File metadata
- Download URL: s3streamer-2024.1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.4.109+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcd8ab1503e7fda3d8af692db97e85e702080556ff104ec7c57edd589fc60d19 |
|
MD5 | 4c2be3ef14ccffe377a04067de040ae4 |
|
BLAKE2b-256 | ab9a80a9030a40de880356e0b9a86209c693e3b0d3b3af3f5eb89018642d919b |