bit_archive

Tar archive writing (gix-archive equivalent)

git
archive
tar
moon add mizchi/bit_archive@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
52
README

#
tar_emit_parent_dirs

fn tar_emit_parent_dirs(out : Array[Byte], path : String, mtime : Int64, emitted : Map[String, Bool]) -> Unit

Emit parent directory entries for a tar path into the output buffer. Tracks already-emitted directories via the emitted map.

#
tar_format_octal

fn tar_format_octal(value : Int64, width : Int) -> String

Format an Int64 value as a zero-padded octal string of the given width.

#
tar_make_header

fn tar_make_header(path : String, mode : Int, size : Int, mtime : Int64, typeflag : Byte, linkname : String) -> FixedArray[Byte]

Build a 512-byte USTAR tar header.

  • path: file path (split into prefix+name if > 100 chars)
  • mode: Unix file mode (e.g. 0o100644)
  • size: file content size in bytes
  • mtime: modification time as Unix timestamp
  • typeflag: tar type flag byte (b'0' = regular, b'5' = directory, b'2' = symlink)
  • linkname: symlink target (empty for non-symlinks)

#
tar_parse_committer_timestamp

fn tar_parse_committer_timestamp(data : Bytes) -> Int64

Parse the committer timestamp from raw commit object bytes. Returns the Unix timestamp as Int64, or 0 if not found.

#
tar_split_path

fn tar_split_path(path : String) -> (String, String)

Split a long path into (name, prefix) for USTAR tar headers. prefix is at most 155 bytes, name at most 100 bytes. Returns (name, prefix). If the path cannot be split, name is truncated.

#
tar_write_string

fn tar_write_string(buf : FixedArray[Byte], offset : Int, s : String, max_len : Int) -> Unit

Write a UTF-8 string into a byte buffer at the given offset, up to max_len bytes.

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io