This release is a pre-release and may not be stable for production use.
file-to-unicode-base64-data-uri
A simple, efficient utility for converting files to Unicode base64-encoded data URIs.
Features
- 📄 Auto-detects the MIME type.
- ♻️ Streaming/generator interface so your program never loads the file fully into memory except for the output string.
- ✅ Python 2 and 3 compatible.
Install
pip install file-to-unicode-base64-data-uri
Usage
# coding=utf-8
from __future__ import print_function
from codecs import open
from file_to_unicode_base64_data_uri import file_to_unicode_base64_data_uri
# Get a single string (data URI)
data_url = file_to_unicode_base64_data_uri('example.png')
print(data_url[:80] + u'...')
# Stream out in chunks (memory efficient for huge files)
from file_to_unicode_base64_data_uri import unicode_base64_data_uri_fragments_generator
with open('output.txt', 'w', 'utf-8') as out:
for fragment in unicode_base64_data_uri_fragments_generator('large_video.mp4'):
out.write(fragment)
Why?
Many libraries read the entire file into memory before encoding or require third-party dependencies. This utility is pure Python, efficient, and works everywhere, even for large files.
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Metadata
Release files for file-to-unicode-base64-data-uri 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| file_to_unicode_base64_data_uri-0.1.0a1.tar.gz | 3.6 kB | Without provenance | Details for file_to_unicode_base64_data_uri-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| file_to_unicode_base64_data_uri-0.1.0a1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for file_to_unicode_base64_data_uri-0.1.0a1-py2.py3-none-any.whl |
Total release size: 7.8 kB
Release files / file_to_unicode_base64_data_uri-0.1.0a1.tar.gz
| Download URL | file_to_unicode_base64_data_uri-0.1.0a1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d1c705a667d89260da1903c46297ebb542840fca9f8de6cf7f3598b440ab12a
|
|
BLAKE2b-256 checksum How to use checksums |
75130801e20f983dff78fac0ef6c347f65a20a3e55608abb4747413f0dbc995e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / file_to_unicode_base64_data_uri-0.1.0a1-py2.py3-none-any.whl
| Download URL | file_to_unicode_base64_data_uri-0.1.0a1-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9c2da103ac2e2492a0dfb6d5272a12e551fea0eac10d02efc1c9a227671fb057
|
|
BLAKE2b-256 checksum How to use checksums |
6dfd1da221cfcbc8ab0e78e48e5bc83c6a373bc77c85f36cba4112780c57321c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for file-to-unicode-base64-data-uri 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.