MCPcopy Create free account
hub / github.com/GuyARoss/orbit / parseStaticDocument

Function parseStaticDocument

examples/basic-react/orbitgen/orb_http.go:49–56  ·  view source on GitHub ↗

parseStaticDocument attempts to find the specified document and return it as a string

(path string)

Source from the content-addressed store, hash-verified

47}
48// parseStaticDocument attempts to find the specified document and return it as a string
49func parseStaticDocument(path string) (string, error) {
50 _, err := os.Stat(path)
51 if !os.IsNotExist(err) {
52 f, _ := ioutil.ReadFile(path)
53 return string(f), nil
54 }
55 return "", fmt.Errorf("static document does not exist for '%s'", publicDir)
56}
57// build buildHTMLPages creates the htmldocument given data for orbits manifest and the page's
58func buildHTMLPages(data []byte, pages ...PageRender) *htmlDoc {
59 body := make([]string, 0)

Callers 3

TestParseStaticDocumentFunction · 0.70
buildHTMLPagesFunction · 0.70
HandleFuncMethod · 0.70

Calls 1

ReadFileMethod · 0.80

Tested by 1

TestParseStaticDocumentFunction · 0.56