Skip to main content

ファイルを指定されたサイズで分割し、分割したファイルを復元するツール

Project description

File Size Splitter

PyPI version License: MIT Python 3.8+

ファイルを指定されたサイズで分割し、分割したファイルを復元するツール。

ライセンス

MIT License

リポジトリ

https://github.com/momoandbanana22/file-size-splitter

仕様

機能1: ファイル分割

  • 指定されたファイルを、指定のサイズで分割する
    • 分割サイズの指定方法:数値のみ(例: 10485760)または単位付き(例: 10M, 1G)の両方に対応
    • 単位: K(キロバイト)、M(メガバイト)、G(ギガバイト)
  • 分割されたファイルには連番を付与する(例: file.001, file.002, ...)
  • 分割情報を記録したメタデータファイルをJSON形式で生成する
    • オリジナルファイルと各分割ファイルのsha512ハッシュを含む
  • 出力先ディレクトリを指定可能(指定なしの場合は入力ファイルと同じディレクトリ)
  • ストリーミング処理でメモリ効率よく分割する(大きなファイルでも対応)
  • 分割時に自動的に復元確認を行い、ファイルの整合性を保証

機能2: 復元用スクリプト生成

  • 分割時にBATファイル(Windows用)とPS1ファイル(PowerShell用)の両方を自動生成
  • 生成されたスクリプトを使用して、分割されたファイルを元のファイルに復元する
  • 復元時のファイル名はメタデータファイルから自動取得
  • 復元時にsha512ハッシュ検証を行い、ファイルの整合性を確認
    • 各分割ファイルのハッシュを検証
    • 復元後のファイルのハッシュを検証

使用方法

ファイル分割

file-size-splitter <入力ファイル> <分割サイズ> [-o 出力ディレクトリ]

例:

# 10MBごとに分割
file-size-splitter largefile.zip 10M

# 出力ディレクトリを指定
file-size-splitter largefile.zip 10M -o output

# バイト数で指定
file-size-splitter largefile.zip 10485760

ファイル復元

分割されたファイル(*.001, .002, ...)とメタデータファイル(.metadata.json)を同じディレクトリに配置し、生成された restore.bat または restore.ps1 を実行します。

# BATファイルを使用(Windows)
restore.bat

# PS1ファイルを使用(PowerShell)
powershell -ExecutionPolicy Bypass -File restore.ps1

インストール

pip install file-size-splitter

ライブラリとしての使用

Pythonスクリプト内からライブラリとして使用することもできます。

from file_size_splitter import split_file, generate_bat_script, generate_ps1_script

# ファイルを分割
metadata = split_file("largefile.zip", "10M", "output")

# 復元スクリプトを生成
generate_bat_script(metadata, "output/restore.bat")
generate_ps1_script(metadata, "output/restore.ps1")

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

file_size_splitter-0.1.7.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.

file_size_splitter-0.1.7-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file file_size_splitter-0.1.7.tar.gz.

File metadata

  • Download URL: file_size_splitter-0.1.7.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for file_size_splitter-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e77ddcc5597d67a2760f97af6ea272dd829742126088b129015c32a339d2710e
MD5 ab52afdac2afe7a520b5c965c0be7e57
BLAKE2b-256 d366d4cc46d72fa729eb26566ec4ce48ea8d4543b742b4bb43505e746a087761

See more details on using hashes here.

Provenance

The following attestation bundles were made for file_size_splitter-0.1.7.tar.gz:

Publisher: publish-to-pypi.yml on momoandbanana22/file-size-splitter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file file_size_splitter-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for file_size_splitter-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e3bec7115ac53d16d7be8063e07e24177ac10685917277096c91cab9e3bed88a
MD5 b19ced98941474ae60ca4d5f063b09d3
BLAKE2b-256 ef445ec8ed119b63dfaa435c75c54fe5591766167c9add2fa4eb2d2466a4b958

See more details on using hashes here.

Provenance

The following attestation bundles were made for file_size_splitter-0.1.7-py3-none-any.whl:

Publisher: publish-to-pypi.yml on momoandbanana22/file-size-splitter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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