开发者

ruby - bzip files

开发者 https://www.devze.com 2023-03-25 19:47 出处:网络
I want to compress the files in ruby. for example I have file: base_1.txt base_2.txt base_3.txt I want these files compressed to base.bz

I want to compress the files in ruby. for example I have file:

base_1.txt
base_2.txt
base_3.txt

I want these files compressed to base.bz

How can I do it in r开发者_StackOverflow中文版uby?


Have you looked at this library:

https://github.com/brianmario/bzip2-ruby


I am not familiar with a standard library function for ruby that performs bz2 operations. There are a few libraries like the one described above from 3rd party.

Ruby also facilitates using the operating systems shell. Assuming Linux: You could call the system call:

system("bzip2 base_1.txt")

or the equivalents:

bzip2 base_1.txt

%x[ bzip2 base_1.txt ]

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号