10 MB.
(dir, name string)
| 405 | const maxDetectionFileSize = 10 * 1024 * 1024 // 10 MB. |
| 406 | |
| 407 | func readFileContent(dir, name string) (string, bool) { |
| 408 | filePath := filepath.Join(dir, name) |
| 409 | info, err := os.Stat(filePath) |
| 410 | if err != nil || info.Size() > maxDetectionFileSize { |
| 411 | return "", false |
| 412 | } |
| 413 | data, err := os.ReadFile(filePath) |
| 414 | if err != nil { |
| 415 | return "", false |
| 416 | } |
| 417 | return string(data), true |
| 418 | } |
| 419 | |
| 420 | // readPackageJSONDeps reads package.json and returns a set of all dependency names |
| 421 | // (from both "dependencies" and "devDependencies"). |
no outgoing calls