# File lib/archive/tar/minitar.rb, line 891
891:     def pack_file(entry, outputter) #:yields action, name, stats:
892:       outputter = outputter.tar if outputter.kind_of?(Archive::Tar::Minitar::Output)
893: 
894:       stats = {}
895: 
896:       if entry.kind_of?(Hash)
897:         name = entry[:name]
898: 
899:         entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
900:       else
901:         name = entry
902:       end
903:       
904:       name = name.sub(%r{\./}, '')
905:       stat = File.stat(name)
906:       stats[:mode]   ||= stat.mode
907:       stats[:mtime]  ||= stat.mtime
908:       stats[:size]   = stat.size
909: 
910:       if RUBY_PLATFORM =~ /win32/
911:         stats[:uid]  = nil
912:         stats[:gid]  = nil
913:       else
914:         stats[:uid]  ||= stat.uid
915:         stats[:gid]  ||= stat.gid
916:       end
917: 
918:       case
919:       when File.file?(name)
920:         outputter.add_file_simple(name, stats) do |os|
921:           stats[:current] = 0
922:           yield :file_start, name, stats if block_given?
923:           File.open(name, "rb") do |ff|
924:             until ff.eof?
925:               stats[:currinc] = os.write(ff.read(4096))
926:               stats[:current] += stats[:currinc]
927:               yield :file_progress, name, stats if block_given?
928:             end
929:           end
930:           yield :file_done, name, stats if block_given?
931:         end
932:       when dir?(name)
933:         yield :dir, name, stats if block_given?
934:         outputter.mkdir(name, stats)
935:       else
936:         raise "Don't yet know how to pack this type of file."
937:       end
938:     end