Skip to main content

Easy way to handle File

Project description

pathkit文件操作

简介

pathkit 是一个用于文件操作的 Python 包,提供一个易于使用的接口来操作文件。

依赖性

基础依赖(安装pathkit时将自动安装):
  • portalocker
  • cryptography
操作具体文件系统需要额外依赖(根据需求手动安装):
文件系统 依赖
HDFS hdfs
MinIO minio

安装

# 通过 pip 安装:
pip install pathkit

初始化连接配置

  1. 配置文件的写入

from pathkit.config import EnvConfig

# 示例:
# 配置名为 'hdfs' 的连接信息
EnvConfig.write("hdfs", url=url)
# 配置名为 'minio' 的连接信息
EnvConfig.write("minio", endpoint=endpoint, access_key=access_key, secret_key=secret_key,
                bucket_name=bucket_name, secure=secure)
# 配置名为 'ftp' 的连接信息
EnvConfig.write("ftp", host=host, user=user, passwd=passwd, pasv=pasv)

文件操作

from pathkit import MinIOPath


p = MinIOPath("/xxx/yyy")

# 判断是否存在
p.exists

# 判断是否为目录
p.is_dir()

# 读取文件内容
p.read()

# 写入文件
p.write(b'xxx')

# 上传文件
p.upload("/xxx/zzz")

# 删除文件
p.delete()

# 创建目录
p.mkdir()

# 遍历目录
p.glob()

# 文件修改时间
p.mtime

# 递归遍历目录
p.rglob()

功能

  • 支持多种文件系统(如 HDFS、MinIO、FTP、Local)
  • 简洁的 API

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pathkit-0.1.2-cp311-cp311-win_amd64.whl (313.5 kB view details)

Uploaded CPython 3.11Windows x86-64

pathkit-0.1.2-cp311-cp311-manylinux_2_17_x86_64.whl (409.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pathkit-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (312.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pathkit-0.1.2-cp311-cp311-macosx_10_9_x86_64.whl (328.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pathkit-0.1.2-cp310-cp310-win_amd64.whl (312.7 kB view details)

Uploaded CPython 3.10Windows x86-64

pathkit-0.1.2-cp310-cp310-manylinux_2_17_x86_64.whl (407.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pathkit-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (312.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pathkit-0.1.2-cp310-cp310-macosx_10_9_x86_64.whl (328.8 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pathkit-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pathkit-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 313.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pathkit-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 24ee522efb8f99fc41e7cc2ccc929790d850563c142edc733262c430b984a82b
MD5 7980c56c2c664d8ecf9de84c4c2a5f12
BLAKE2b-256 9312b2d109f1972563df6bd624fe79319daf1b74aa2a6e58d72f3e8ed1ee8c45

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.2-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 52a92349c5c566a8b511ab8e71ca3f2914357d5de02f5dd4acae1430b86f2134
MD5 4cb7956e86895d4a92419c9f6cf1c2ec
BLAKE2b-256 39e7c07a391696ac85b02005482bb17ddaac7a1e52faee40b802e86a09ca16f1

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fdc28ac30ffea603b8223ef03c223e44329a9f10fe9da0ec95ff28cc5f679b1b
MD5 b0f01fa2af79032adbd63f131a98f8e4
BLAKE2b-256 1f337da60c7ece342c1e93803be849caa4bd1dbf8f6c5bb7c9a8f5fad83f7c12

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d0011c077f92682b3881d6214071d0d5d050dd26234887306c6dd2988232528
MD5 c0a2f24a3da11e508cd23401d340de59
BLAKE2b-256 086cbd6c1d4f7ed6f1d4ec3909d3fb4d31813a9ecfa8f8d291c463dcaefe0dbf

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pathkit-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 312.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pathkit-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5a6c28079aef58158a0694bd5faa6ee19e263a5781556b65a24aa23463432207
MD5 8c8c8aa5ad6d2b0430230b4654897a00
BLAKE2b-256 06980a1d02e5dab911da91c8120fee6c8f4805a036d66ada7c0a01ac636925dd

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.2-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d4a42eed6ce05eaef07f60a1d0110a5a74445c5b50e7ec321d7d8c3d00c326aa
MD5 6fca57e87874a61a7a747b7b3f5d4986
BLAKE2b-256 27804c2c456a089ab7e36b1b4aaff316301d5775464982fdea11f51ea1b2afc6

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48594eb7b84ffc7bbbc171a7c8938390cd0cfd0324f1a089008af67f4bb349f6
MD5 4f44db00da3db6c0c7cfe22dc4b355cd
BLAKE2b-256 23ebca05ed932431cc1b98323ae9d6790b5513997019c8cf306437fe0a161e64

See more details on using hashes here.

File details

Details for the file pathkit-0.1.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pathkit-0.1.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aa08e87d12f2bd1f9cf472058182f2d33c5879627f2a2178967fa61515d9fd59
MD5 f90fd29b163ca9df06a259e3b3b0e6fa
BLAKE2b-256 ac6d2289594bc00070610573050fed829f045611b4e35de05ff105cc85f7eb04

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