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.0-cp311-cp311-win_amd64.whl (310.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pathkit-0.1.0-cp311-cp311-manylinux_2_17_x86_64.whl (403.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pathkit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (308.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pathkit-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl (324.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pathkit-0.1.0-cp310-cp310-win_amd64.whl (309.5 kB view details)

Uploaded CPython 3.10Windows x86-64

pathkit-0.1.0-cp310-cp310-manylinux_2_17_x86_64.whl (403.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pathkit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (308.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pathkit-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl (325.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pathkit-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 310.1 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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cde16e58d18b3b93a631d0f671376968015f63f5ff807a23dcc4029a3ce31a57
MD5 b28efb57d36c5b1c83be3ad2e50288e2
BLAKE2b-256 ae96718bc9e87d1f3a16a66a054945ff880a179efebd6c38255cf79326c75bfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.0-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8b377f5909b96490b5af933df74f150026c277df06eeb0887f439b17e2532305
MD5 053d7de8c8ec2ee921db2489ee8ca42d
BLAKE2b-256 cf295f8fdc018e13c8ddfa5a6994e4a4ee98624b1351dbb4f0f330b0ad6d4601

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2bc749789051a42d9d51ebdead67e70702dae7cfb00958f744021bb1f47a363b
MD5 d8f1e49481b35d502f7ea3b494e2b028
BLAKE2b-256 0ac0067d72af06040abbb3f3b523c3592fd2c1d1d9e491477c142b94a0d37891

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d99dfba8803cb685a647cf44a582162ffb127a6bb08b439afedcecb03602b98e
MD5 c16259433edab5436d022bfb82cc2c36
BLAKE2b-256 200938b7ef39acdc351950be404d4a8f8108c15426a9a5cfa45dd4fb2b1e817f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pathkit-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 309.5 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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 19452fd2f85825e50ec1ce2ef9b17b3ce306b5033c5533410a4023eddd599f3a
MD5 8b7b0043680b135c349307182cc84e36
BLAKE2b-256 89ec6952b49fcaf0e1928c2475b29a13727233b36500c08aab74e6ca5157a518

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.0-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2b7c32d48bf9ba1ace0a564e9f19eaa15226fbc0ffa43fe9b64ca0e0ae28d403
MD5 d52f5980b1afb6429b9e6466814533ae
BLAKE2b-256 77cd5b8c5bd86ec4b9b8a80ee48c1d996db8f4988e4e66cde28d734e77f596e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d8978738f987da8216d41ac7de100d6f3ae541e2f09e19f4ea44c1453b8f228
MD5 c94a97595a2f604ef880d90054c97d50
BLAKE2b-256 0f75533deeb07a6d2a9e49a97725122442eeee4679a6cb9acdc9a8e4dadfa1ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5c25ddfa32bb90f978cafde186995e16c8a70bbfdc6cd510d2ef677e812b5408
MD5 7cd7969e4f478d84acec1c1b566f6227
BLAKE2b-256 d9a692a9ca2ed9b2d4de0249b074aad8e6e3ff7fc048b752de9be4a53e6a6ff8

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