1
0
mirror of https://github.com/garraflavatra/go-fmp.git synced 2025-06-28 12:35:12 +00:00

Add debug utils

This commit is contained in:
2025-06-12 09:41:46 +02:00
parent 564e1c4ce6
commit 47eeaa4255
3 changed files with 28 additions and 5 deletions

26
fmp/fmp_debug.go Normal file
View File

@ -0,0 +1,26 @@
package fmp
import (
"fmt"
"os"
)
func (f *FmpFile) ToDebugFile(fname string) {
fo, err := os.Create(fname)
if err != nil {
panic(err)
}
defer func() {
if err := fo.Close(); err != nil {
panic(err)
}
}()
for _, chunk := range f.Chunks {
fmt.Fprintf(fo, "%s, %s\n", chunk.String(), string(chunk.Value))
}
}
func (c *FmpChunk) String() string {
return fmt.Sprintf("<%v(%v)>", c.Type, c.Length)
}