MCPcopy Create free account
hub / github.com/ethereum/node-crawler / WriteNodesJSON

Method WriteNodesJSON

pkg/common/nodes.go:63–75  ·  view source on GitHub ↗
(file string)

Source from the content-addressed store, hash-verified

61}
62
63func (nodes NodeSet) WriteNodesJSON(file string) {
64 nodesJSON, err := json.MarshalIndent(nodes, "", jsonIndent)
65 if err != nil {
66 panic(err)
67 }
68 if file == "-" {
69 os.Stdout.Write(nodesJSON)
70 return
71 }
72 if err := os.WriteFile(file, nodesJSON, 0644); err != nil {
73 panic(err)
74 }
75}
76
77// Nodes returns the node records contained in the set.
78func (ns NodeSet) Nodes() []*enode.Node {

Callers 1

crawlNodesFunction · 0.80

Calls 1

WriteMethod · 0.80

Tested by

no test coverage detected