# frozen_string_literal: true module Uricp::Strategy class PipedLocalDecompress include Uricp::Strategy::Common def appropriate? case from.scheme when 'pipe' if raw_target? && lz4_source? && to.scheme == 'file' return proposal if always_write_sparse? debug "#{self.class.name}: using safe sparse expansion via stream" end end debug "#{self.class.name}: not appropriate" false end def command "lz4 -qdf - #{to.path};" end def proposal @proposed_options = options.dup @proposed_options.delete('source-format') if @proposed_options['target-format'] @proposed_options['source-format'] = :raw if @proposed_options['source-format'] == @proposed_options['target-format'] @proposed_options.delete('source-format') @proposed_options.delete('target-format') end end @proposed_options['from_uri'] = @proposed_options['to_uri'] self end end end