MCPcopy
hub / github.com/esm-dev/esm.sh / Get

Method Get

internal/storage/storage_fs.go:66–81  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

64}
65
66func (fs *fsStorage) Get(key string) (content io.ReadCloser, stat Stat, err error) {
67 filename, err := fs.joinRootSafe(key)
68 if err != nil {
69 return
70 }
71 file, err := os.Open(filename)
72 if err != nil && (os.IsNotExist(err) || strings.HasSuffix(err.Error(), "not a directory")) {
73 err = ErrNotFound
74 }
75 if err != nil {
76 return
77 }
78 content = file
79 stat, err = os.Stat(filename)
80 return
81}
82
83func (fs *fsStorage) Put(key string, content io.Reader) (err error) {
84 filename, err := fs.joinRootSafe(key)

Callers

nothing calls this directly

Calls 3

joinRootSafeMethod · 0.95
ErrorMethod · 0.80
StatMethod · 0.65

Tested by

no test coverage detected