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

Uploaded CPython 3.11Windows x86-64

pathkit-0.1.1-cp311-cp311-manylinux_2_17_x86_64.whl (403.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pathkit-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (307.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pathkit-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl (324.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pathkit-0.1.1-cp310-cp310-win_amd64.whl (309.1 kB view details)

Uploaded CPython 3.10Windows x86-64

pathkit-0.1.1-cp310-cp310-manylinux_2_17_x86_64.whl (402.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pathkit-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (307.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pathkit-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl (324.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pathkit-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 309.6 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4ca99fb84c960f1c0aac761d4238b523ea904713eda4a69a1c16e59d0a0f12e8
MD5 23e0ac31945fc13a58ffdba703815e89
BLAKE2b-256 2bbaaa06f046aae844956981cd3a19e353fa2c2c922dd31f1cb7703fd65b1afb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.1-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bff6f767a0d0e41ef8f53a117ebf2e909c1ae84013081419994bcb1067d5fc6c
MD5 e2880f565a656b9980d5d94a7d5827bf
BLAKE2b-256 31c62693e4671e56fc4657b8a61792c4d8200668241ff4ed825bf8af5424f088

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 523ddd190fa887c10525c6e4d1d966def7871236c632555bce2f3c474efd4a5a
MD5 a58b4d1e327a843460a1be12b3f804ea
BLAKE2b-256 4d85750ac1091bb43c3fec597ef2a4f8f0e00666d546244fc4cfb4c29e21e1eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 426e67e92969996ad21bb74bf2598b18558982ce4af44ce4f638f55f3e0d0f97
MD5 1a695caee84449019a1a8641e18b6c70
BLAKE2b-256 c033827b6b3457d4eb9dc767d33e7150d5666986b5acdb81630c1217f696c387

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pathkit-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 309.1 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ad7782cffb431053f024a808b2c49775fd13ad95c3ad397c2270a5414c4a3536
MD5 ba71f70bcee890a3bfe9782a8d2519c0
BLAKE2b-256 7a570381c989a8743f396c0aa22492596e3aae9ad72012748cde97ceb6b23f8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.1-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d307e43c646d5b3a97adac590a2725d44ee54e0e3ebd0dfb09f3975eb786d0b7
MD5 decd6c933a7116ca59567fd47ab39e02
BLAKE2b-256 6948b4ae40d1d790f77b6b395c66af31b82ecb202b5c32797a1b105bb68b0148

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06d6426e0cdf67b410fdda96460ce7d1751dc4692109e721c3833a42a131e3fd
MD5 a91de2647466bac5c15196860ff9a0fe
BLAKE2b-256 846ebcef2bae6c087a44a18d0d8e4510b2b826ae6c0ecc2e97ba7347397a9ff6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pathkit-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ba1f2cd40f813c881ea5daa8d255f93fa86d8803ba291c1d2514a3bab6d0242c
MD5 3174ada512bae783b4cd6734a5ca585f
BLAKE2b-256 36948a8b0e825d1589da35db2fc8cd23d355a61bb4e1e5e1ebb1c3590d15edcd

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