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:
26
fmp/fmp_debug.go
Normal file
26
fmp/fmp_debug.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user