0

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 ruby?

Sayuj
  • 7,464
  • 13
  • 59
  • 76

2 Answers2

1

Have you looked at this library:

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

Michael Kohl
  • 66,324
  • 14
  • 138
  • 158
0

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 ]

kwoodson
  • 959
  • 9
  • 11