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

Function ReadFile

pkg/cmdutil/file_input.go:11–19  ·  view source on GitHub ↗

5MB

(filename string, stdin io.ReadCloser)

Source from the content-addressed store, hash-verified

9const maxCapacity = 1024 * 5120 // 5MB
10
11func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error) {
12 if filename == "-" {
13 b, err := io.ReadAll(stdin)
14 _ = stdin.Close()
15 return b, err
16 }
17
18 return os.ReadFile(filename)
19}
20
21func ScanFile(filename string, stdin io.ReadCloser) (*bufio.Scanner, error) {
22 var scanner *bufio.Scanner

Callers 5

NewImportCmdFunction · 0.92
runUpsertCmdFunction · 0.92
runUpsertCmdFunction · 0.92
NewTestCmdFunction · 0.92
NewCreateCmdFunction · 0.92

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected