I have a function in my activejob that extracts a specific file from a zip file. Following code extracted empty file.
def extract_file(from, name)
to = get_local_dest(name)
Zip::File.open(from) do |zip_file|
entry = zip_file.glob(name).first
puts entry.get_input_stream.read
entry.extract(to)
end
return to
end
I added a debugger and ran following line of code in console then the extracted file was not empty.
entry.extract(to)
Can anyone help me with this issue? Why this function is extract empty file when it runs in activejob?