Skip to main content

Cross-platform, file handler using native pickers and security models.

Project description

xfilepy


Cross-platform, file handler using native pickers and security models.

Provides overloads for creating file handlers via native file pickers and saving/loading persistent access grants. Supported platforms are Android, iOS, and Desktop (Windows, macOS, Linux). On all platforms you can choose files outside your app's sandbox using the native file picker without asking the user for broad filesystem permissions. Access to the chosen files is mediated by platform-specific security models (e.g., SAF on Android, security-scoped bookmarks on iOS). This allows your app to write to the files later without re-prompting the user, even across app restarts.

Design goals:

  • zero side effects at import
  • late binding to the active platform
  • no runtime deps for platforms you don’t use.

Usage

See API Documentation for full details. Here is a brief example:

from xfile import FileHandler

# Open via native picker
FileHandler.create_via_picker(lambda fh: fh.read_bytes(lambda b: print(len(b))))

# Save via native "Save as…"
FileHandler.create_via_save_dialog(lambda fh: fh.write_bytes(b"hello"))

# Rehydrate a previously granted URI/bookmark
fh = FileHandler.from_uri_string(saved_string, require_write=True)
fh.append_bytes(b"!\n")

# Serialize back to store in your settings
persist = fh.to_uri_string()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xfilepy-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xfilepy-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file xfilepy-0.1.0.tar.gz.

File metadata

  • Download URL: xfilepy-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xfilepy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63e318e7fd6d26610eab794651575e099d1a5fdbf94b2fc69a74e0cd81f33fae
MD5 87407efadcd865ed4700df2d6e2c648f
BLAKE2b-256 5d667501e7484168e7294af440824dedc19b44fc84d4ca7f08e44bd591a246cf

See more details on using hashes here.

File details

Details for the file xfilepy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xfilepy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xfilepy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3b3f0e48a8587ca9a39e58c3a93093ebee3b197eb272315a568637a948cc78b
MD5 71f492ea181ebd56166566bd9d8085f5
BLAKE2b-256 3b17d8eccde25062c83321a21a3c8d49d0ae259733473036f1ccc60be16184e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page