Package sauce is a Go module that parses SAUCE (Standard Architecture for Universal Comment Extensions) metadata.
- Parse SAUCE metadata from files
- Extract comprehensive file information (title, author, group, date, etc.)
- Support multiple file types and data types
- Extract type-specific information
- Parse comment blocks
- Serialize to JSON format
- Format dates and sizes for human readability
- Provide comprehensive error handling
The Standard Architecture for Universal Comment Extensions, or SAUCE as it is more commonly known, is an architecture or protocol for attaching metadata or comments about files. Primarily designed for ANSI art files, SAUCE supports many different file types.
For the complete specification see:
http://www.acid.org/info/sauce/sauce.htm
https://github.com/radman1/sauce
Go Package with docs and examples.
// Open a file
file, err := os.Open("artwork.ans")
if err != nil {
log.Fatal(err)
}
defer file.Close()
// Read the file and create a SAUCE record
sr, err := sauce.Read(file)
if err != nil {
log.Println(err)
return
}
// print specific SAUCE fields
fmt.Printf("%q\n", sr.Title)
fmt.Printf("Author:\t%s.\n", sr.Author)
fmt.Printf("Group:\t%s.\n", sr.Group)
fmt.Printf("Date:\t%s.\n", sr.Date.Time.Format(time.ANSIC))
// print the SAUCE data as indented JSON
js, err := sr.JSONIndent(" ")
if err != nil {
log.Println(err)
return
}
fmt.Printf("%s", js)-
id
SAUCE identification. This should be equal toSAUCE. -
version
SAUCE version number, should be00. -
title
Title of the file. -
author
The nick, name or handle of the creator of the file. -
group
The name of the group or company the creator is employed by. -
date- The date the file was created. -
value- SAUCE date format, CCYYMMDD (century, year, month, day).
-
iso-valueas an ISO 8601 date.
-
epoch-valueas Unix time, the number of seconds since 1 Jan 1970.
-
fileSize -
bytes- The reported file size not including the SAUCE information.
-
decimal-bytesreturned as a base 10 value (kilo, mega...).
-
binary-bytesreturned as a base 2 value (kibi, mebi...).
-
dataType- Type of data. -
type-DataTypevalue.
-
name-DataTypename.
-
fileType- Type of file. -
type-FileTypevalue.
-
name-FileTypename.
-
typeInfo- Type-dependent information, see http://www.acid.org/info/sauce/sauce.htm#FileType1value- Value ofTInfo1info- Human-readable description of the value
2value- Value ofTInfo2info- Human-readable description of the value
3value- Value ofTInfo3info- Human-readable description of the value
-
flags- Type-dependent flagsdecimal- Value as an unsigned integerbinary- Value in binary notationnonBlinkMode- Request ANSI non-blink mode (iCE Color)flag- Value as binary bit boolean ("0" or "1")interpretation- Human-readable description of the value
letterSpacing- ANSI letter-spacing to request 8 or 9 pixel font selectionflag- Value as a 2-bit binary string ("00", "01", "10")interpretation- Human-readable description of the value
aspectRatio- ANSI aspect ratio to request LCD square or CRT monitor style pixelsflag- Value as a 2-bit binary string ("00", "01", "10")interpretation- Human-readable description of the value
-
fontName- The creator's preferred font to view the ANSI artwork, see http://www.acid.org/info/sauce/sauce.htm#FontName -
comments- Comments or notes from the creatorid- SAUCE comment block identification, this should be "COMNT"count- The reported number of lines in the SAUCE comment blocklines- Lines of text, each line should comprise 64 characters
- Go, textmodes sauce
- Python, Parser for SAUCE
- Elixir, Saucexages