/
doc.go
40 lines (31 loc) · 855 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
This module provides an API to access and programmatically process
Debian `.deb` archives on disk.
Debian files, at a high level, are `ar(1)` archives, which
contain a few sections, most notably the `control` member, which contains
information about the Debian package itself, and the `data` member, which
contains the actual contents of the files, as they should be written out
on disk.
Here's a trivial example, which will print out the Package name for a
`.deb` archive given on the command line:
package main
import (
"log"
"os"
"github.com/cinello/go-debian/deb"
)
func main() {
path := os.Args[1]
fd, err := os.Open(path)
if err != nil {
panic(err)
}
defer fd.Close()
debFile, err := deb.Load(fd, path)
if err != nil {
panic(err)
}
log.Printf("Package: %s\n", debFile.Control.Package)
}
*/
package deb