class File
Public Class Methods
is_zip?(file_path)
click to toggle source
# File lib/seqtrimnext/utils/string_utils.rb, line 31 def self.is_zip?(file_path) res=false begin f=File.open(file_path,'rb') head=f.read(4) f.close res=(head=="PK\x03\x04") rescue res=false end return res end
unzip(file_path)
click to toggle source
# File lib/seqtrimnext/utils/string_utils.rb, line 45 def self.unzip(file_path) unzipped=`unzip "#{file_path}"` file_list = unzipped.split("\n") list=[] # select only the files, not folders list=file_list.select{|e| e=~/inflating/}.map{|e| e.gsub('inflating:','').strip} return list end