Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ルビーでファイルを圧縮したい。たとえば、私はファイルを持っています:
base_1.txt base_2.txt base_3.txt
これらのファイルをに圧縮したいbase.bz
base.bz
どうすればルビーでそれを行うことができますか?
このライブラリを見たことがありますか:
https://github.com/brianmario/bzip2-ruby
私はbz2操作を実行するrubyの標準ライブラリ関数に精通していません。上記のようなサードパーティ製のライブラリがいくつかあります。
Rubyは、オペレーティングシステムシェルの使用も容易にします。Linuxの場合:システムコールを呼び出すことができます。
system( "bzip2 base_1.txt")
または同等のもの:
bzip2 base_1.txt
%x [bzip2 base_1.txt]