MCPcopy
hub / github.com/rclone/rclone / NewFsFile

Function NewFsFile

cmd/cmd.go:85–105  ·  view source on GitHub ↗

NewFsFile creates an Fs from a name but may point to a file. It returns a string with the file name if points to a file otherwise "".

(remote string)

Source from the content-addressed store, hash-verified

83// It returns a string with the file name if points to a file
84// otherwise "".
85func NewFsFile(remote string) (fs.Fs, string) {
86 ctx := context.Background()
87 _, fsPath, err := fspath.SplitFs(remote)
88 if err != nil {
89 err = fs.CountError(ctx, err)
90 fs.Fatalf(nil, "Failed to create file system for %q: %v", remote, err)
91 }
92 f, err := cache.Get(ctx, remote)
93 switch err {
94 case fs.ErrorIsFile:
95 cache.Pin(f) // pin indefinitely since it was on the CLI
96 return f, path.Base(fsPath)
97 case nil:
98 cache.Pin(f) // pin indefinitely since it was on the CLI
99 return f, ""
100 default:
101 err = fs.CountError(ctx, err)
102 fs.Fatalf(nil, "Failed to create file system for %q: %v", remote, err)
103 }
104 return nil, ""
105}
106
107// newFsFileAddFilter creates an src Fs from a name
108//

Callers 11

link.goFile · 0.92
convmv.goFile · 0.92
deletefile.goFile · 0.92
hashsum.goFile · 0.92
lsjson.goFile · 0.92
md5sum.goFile · 0.92
extract.goFile · 0.92
list.goFile · 0.92
sha1sum.goFile · 0.92
newFsFileAddFilterFunction · 0.85
NewFsSrcFileDstFunction · 0.85

Calls 5

SplitFsFunction · 0.92
FatalfFunction · 0.92
GetFunction · 0.92
PinFunction · 0.92
BaseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…