yellow~ opinionated web scanning pipeline for pentesters in a hurry |
| git clone https://github.com/djnnvx/yellow.git |
| log | files | refs | archive | README | LICENSE |
io.go (566B)
1 package core 2 3 import ( 4 "io" 5 "os" 6 "strings" 7 ) 8 9 // SaveStream writes r to path without holding it in memory. 10 func SaveStream(path string, r io.Reader) (int64, error) { 11 f, err := os.Create(path) 12 if err != nil { 13 return 0, err 14 } 15 n, err := io.Copy(f, r) 16 if cerr := f.Close(); err == nil { 17 err = cerr 18 } 19 return n, err 20 } 21 22 // WriteLines writes one entry per line, with a trailing newline unless empty. 23 func WriteLines(path string, lines []string) error { 24 s := strings.Join(lines, "\n") 25 if s != "" { 26 s += "\n" 27 } 28 return os.WriteFile(path, []byte(s), 0644) 29 }