MCPcopy Create free account
hub / github.com/algolia/cli / ScanFile

Function ScanFile

pkg/cmdutil/file_input.go:21–37  ·  view source on GitHub ↗
(filename string, stdin io.ReadCloser)

Source from the content-addressed store, hash-verified

19}
20
21func ScanFile(filename string, stdin io.ReadCloser) (*bufio.Scanner, error) {
22 var scanner *bufio.Scanner
23
24 if filename == "-" {
25 scanner = bufio.NewScanner(stdin)
26 } else {
27 f, err := os.Open(filename)
28 if err != nil {
29 return nil, err
30 }
31 scanner = bufio.NewScanner(f)
32 }
33
34 buffer := make([]byte, maxCapacity)
35 scanner.Buffer(buffer, maxCapacity)
36 return scanner, nil
37}

Callers 6

NewImportCmdFunction · 0.92
NewUpdateCmdFunction · 0.92
NewOperationsCmdFunction · 0.92
NewImportCmdFunction · 0.92
NewImportCmdFunction · 0.92
NewImportCmdFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected