MCPcopy
hub / github.com/wavetermdev/waveterm / ReadAppFileCommand

Method ReadAppFileCommand

pkg/wshrpc/wshserver/wshserver.go:1005–1022  ·  view source on GitHub ↗
(ctx context.Context, data wshrpc.CommandReadAppFileData)

Source from the content-addressed store, hash-verified

1003}
1004
1005func (ws *WshServer) ReadAppFileCommand(ctx context.Context, data wshrpc.CommandReadAppFileData) (*wshrpc.CommandReadAppFileRtnData, error) {
1006 if data.AppId == "" {
1007 return nil, fmt.Errorf("must provide an appId to ReadAppFileCommand")
1008 }
1009 fileData, err := waveappstore.ReadAppFile(data.AppId, data.FileName)
1010 if err != nil {
1011 if errors.Is(err, os.ErrNotExist) {
1012 return &wshrpc.CommandReadAppFileRtnData{
1013 NotFound: true,
1014 }, nil
1015 }
1016 return nil, fmt.Errorf("failed to read app file: %w", err)
1017 }
1018 return &wshrpc.CommandReadAppFileRtnData{
1019 Data64: base64.StdEncoding.EncodeToString(fileData.Contents),
1020 ModTs: fileData.ModTs,
1021 }, nil
1022}
1023
1024func (ws *WshServer) WriteAppFileCommand(ctx context.Context, data wshrpc.CommandWriteAppFileData) error {
1025 if data.AppId == "" {

Callers

nothing calls this directly

Calls 1

ReadAppFileFunction · 0.92

Tested by

no test coverage detected