MCPcopy
hub / github.com/projectdiscovery/katana / appendToFileField

Function appendToFileField

pkg/output/fields.go:86–99  ·  view source on GitHub ↗
(parsed *url.URL, field, data string)

Source from the content-addressed store, hash-verified

84}
85
86func appendToFileField(parsed *url.URL, field, data string) {
87 file, err := os.OpenFile(path.Join(storeFieldDir, fmt.Sprintf("%s_%s_%s.txt", parsed.Scheme, parsed.Hostname(), field)), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
88 if err != nil {
89 return
90 }
91 defer func() {
92 if err := file.Close(); err != nil {
93 gologger.Error().Msgf("Error closing file: %v\n", err)
94 }
95 }()
96
97 _, _ = file.WriteString(data)
98 _, _ = file.Write([]byte("\n"))
99}
100
101// formatField formats output results based on fields from fieldNames
102func formatField(output *Result, fields string) []fieldOutput {

Callers 1

storeFieldsFunction · 0.85

Calls 2

CloseMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected