lib/spatial_features/download.rb in spatial_features-2.14.1 vs lib/spatial_features/download.rb in spatial_features-2.15.0
- old
+ new
@@ -10,11 +10,11 @@
end
def self.open(file, unzip: nil, **unzip_options)
file = Kernel.open(file)
file = normalize_file(file) if file.is_a?(StringIO)
- if Unzip.is_zip?(file)
+ if unzip && Unzip.is_zip?(file)
file = find_in_zip(file, find: unzip, **unzip_options)
end
return file
end
@@ -22,9 +22,15 @@
Tempfile.new.tap do |temp|
temp.binmode
temp.write(file.read)
temp.rewind
end
+ end
+
+ def self.entries(file)
+ file = Kernel.open(file)
+ file = normalize_file(file) if file.is_a?(StringIO)
+ Unzip.entries(file)
end
def self.find_in_zip(file, find:, **unzip_options)
return File.open(Unzip.paths(file, :find => find, **unzip_options))
end