~mrms/tarum

A tar library for Umka

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~mrms/tarum
read/write
git@git.sr.ht:~mrms/tarum

You can also use your local clone with git send-email.

#tar.um

A tar archive library for Umka. Install using PAK.

#Example

import (
        "pak/tar/tar.um"
)

fn main() {
    var err: tar.Errno
    var t: tar.Tar
        
    t, err = tar.open("test.tar", "w")
    if err != 0 {
        printf("Error opening tar file: %s\n", tar.strerror(err))
        return
    }
    
    t.addFile("pak.json")
    t.addFile("pak/")
    t.addFile("README.md")
    
    err = t.finalize()
    if err != 0 {
        printf("Error finalizing tar file: %s\n", tar.strerror(err))
        return
    }
    
    err = t.close()
    if err != 0 {
        printf("Error closing tar file: %s\n", tar.strerror(err))
        return
    }
    
    t, err = tar.open("test.tar", "r")
    if err != 0 {
        printf("Error opening tar file: %s\n", tar.strerror(err))
        return
    }
        
    err = t.extract("extracted")
    if err != 0 {
        printf("Error extracting tar file: %s\n", tar.strerror(err))
        return
    }
    
    err = t.close()
    if err != 0 {
        printf("Error closing tar file: %s\n", tar.strerror(err))
        return
    }
}

#License

Unlicense/MIT