MCPcopy
hub / github.com/rclone/rclone / ListJSON

Function ListJSON

fs/operations/lsjson.go:243–267  ·  view source on GitHub ↗

ListJSON lists fsrc using the options in opt calling callback for each item

(ctx context.Context, fsrc fs.Fs, remote string, opt *ListJSONOpt, callback func(*ListJSONItem) error)

Source from the content-addressed store, hash-verified

241
242// ListJSON lists fsrc using the options in opt calling callback for each item
243func ListJSON(ctx context.Context, fsrc fs.Fs, remote string, opt *ListJSONOpt, callback func(*ListJSONItem) error) error {
244 lj, err := newListJSON(ctx, fsrc, remote, opt)
245 if err != nil {
246 return err
247 }
248 err = walk.ListR(ctx, fsrc, remote, false, ConfigMaxDepth(ctx, lj.opt.Recurse), walk.ListAll, func(entries fs.DirEntries) (err error) {
249 for _, entry := range entries {
250 item, err := lj.entry(ctx, entry)
251 if err != nil {
252 return fmt.Errorf("creating entry failed in ListJSON: %w", err)
253 }
254 if item != nil {
255 err = callback(item)
256 if err != nil {
257 return fmt.Errorf("callback failed in ListJSON: %w", err)
258 }
259 }
260 }
261 return nil
262 })
263 if err != nil {
264 return fmt.Errorf("error in ListJSON: %w", err)
265 }
266 return nil
267}
268
269// StatJSON returns a single JSON stat entry for the fsrc, remote path
270//

Callers 6

LsfFunction · 0.92
listSubdirsMethod · 0.92
lsjson.goFile · 0.92
DstLsfFunction · 0.92
TestListJSONFunction · 0.92
rcListFunction · 0.85

Calls 5

ListRFunction · 0.92
newListJSONFunction · 0.85
ConfigMaxDepthFunction · 0.85
entryMethod · 0.80
ErrorfMethod · 0.45

Tested by 3

listSubdirsMethod · 0.74
DstLsfFunction · 0.74
TestListJSONFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…