Skip to main content

Easy Binary File Package

Easy way to use binary files with built in class and functions.

Installation from PYPI

You can find last version of project in: https://pypi.org/project/easy-binary-file/

Command to install:

pip install easy-binary-file

Quick use

Simply import and use functions or class

Example of function to dump a single value:

from easy_binary_file import dump_single_value

dump_single_value("test_file_single.tmp", "test_value")

Example of function to load a single value:

from easy_binary_file import load_single_value

value = load_single_value("test_file_single.tmp")
print(value)

Example of instance of class to dump several values:

from easy_binary_file import EasyBinaryFile

with EasyBinaryFile("test_ebf_object.tmp") as ebf:
    ebf.dump("First value")
    ebf.dump("Second value")

Example of instance of class to read all items:

from easy_binary_file import EasyBinaryFile

with EasyBinaryFile("test_ebf_object.tmp", "rb") as ebf:
    for item in ebf:
        print(item)

Import

Import functions, class or all.

from easy_binary_file import *

Content

This is a review of class and functions content inside.

The difference between use functions vs class:

  • Functions open and close file in each use (For use a lot, functions are slower than class)
  • Instance of class maintain open the file until end of use (or call to close)

You have complete docstring documentation in code and more examples/tests in doctest format.

Functions:

  • dump_ensure_space: Only dump value if space enough in disk.
  • dump_single_value: Open a file in the binary mode, dump a single value and close file
  • load_single_value: Open a file in the binary mode, load a single value, return it and close file
  • dump_items: Serialize one iterable in a single file
  • load_items: Deserialize item by item in one stream generator
  • quick_dump_items: Quick open a file in ab or wb mode and dump items one by one from iterator, when generator is exhausted then close the file.
  • quick_load_items: Quick open a file in rb mode and load items in one generator, when generator is exhausted then close the file.

Class:

  • EasyBinaryFile: Open (or create if not exist) a new binary file.
    • close: Close the binary file.
    • dump: Dump one single value in file.
    • dump_ensure_space: Dump one single value in file only if space enough in disk.
    • load: Load from file one single value.
    • get_cursor_position: Get last position of cursor in file.
    • seek: Seek file in position.
    • get_by_cursor_position: Get value by cursor position in file.
    • dump_items: Serialize one iterable in a file.
    • load_items: Deserialize item by item in one stream generator.
    • __iter__: wrap of load_items result to use directly in a for loop.

Is useful for you?

Maybe you would be so kind to consider the amount of hours puts in, the great effort and the resources expended in doing this project. Thank you.

paypal

Metadata

Release files for easy-binary-file 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easy-binary-file 1.0.4
File Size Uploaded Provenance Actions
easy-binary-file-1.0.4.tar.gz 4.7 kB Without provenance Details for easy-binary-file-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easy-binary-file 1.0.4
File Interpreter ABI Platform Actions
easy_binary_file-1.0.4-py3-none-any.whl Python 3 none any Details for easy_binary_file-1.0.4-py3-none-any.whl

Total release size: 10.8 kB

Release files / easy-binary-file-1.0.4.tar.gz

Download URL easy-binary-file-1.0.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b3e3047c18cea101cf585644a55c223f1bad68ec01f8ce59dc03250f45944b70
BLAKE2b-256 checksum
How to use checksums
87b719f97ca10ab53d31f2e23c2c25faad00cda01cf19f852a981cf0e5bcf5f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

Release files / easy_binary_file-1.0.4-py3-none-any.whl

Download URL easy_binary_file-1.0.4-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bad8eb67450daa59fdeec08da5e0e4d6109bd466bfe032aed089ac28b924120c
BLAKE2b-256 checksum
How to use checksums
81e909e801acd3e20e256d6a3fa6946aa6856645bee8bcf847f110314f102e99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

Security for easy-binary-file 1.0.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page