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 xfilepy 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…"
fh = FileHandler.create_via_save_dialog(lambda fh: fh.write_bytes(b"hello"))

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

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

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.2.0.tar.gz (9.4 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.2.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xfilepy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 be4840d03e9af211a5257a99d2162a88ed62744a2609d901fe0aa23d86a6c543
MD5 140f50792eb9828761673eb408638e05
BLAKE2b-256 67a6365ada23a198166cd1d1382af52783577c2b4efd312f091fe8857105988a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xfilepy-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 851edeaea4f5ad2700e94fbbf5a8d3e2a435e2da89c618271873b66f57e74e56
MD5 5d306bafe3357dd8508311ad73fee7c4
BLAKE2b-256 35ea429569b1262dadc6b3c171861b4fbec4e00ec05404cd9717d02afbee62c1

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