MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / NewLocalFile

Function NewLocalFile

message/elements.go:333–343  ·  view source on GitHub ↗
(path string, name ...string)

Source from the content-addressed store, hash-verified

331}
332
333func NewLocalFile(path string, name ...string) (*FileElement, error) {
334 file, err := os.Open(path)
335 if err != nil {
336 return nil, err
337 }
338 return NewStreamFile(file, utils.LazyTernary(len(name) == 0, func() string {
339 return filepath.Base(file.Name())
340 }, func() string {
341 return name[0]
342 })), nil
343}
344
345func NewLightApp(content string) *LightAppElement {
346 return &LightAppElement{

Callers

nothing calls this directly

Calls 3

LazyTernaryFunction · 0.92
NewStreamFileFunction · 0.85
NameMethod · 0.45

Tested by

no test coverage detected