MCPcopy Create free account
hub / github.com/dropbox/dbxcli / createDownloadTemp

Function createDownloadTemp

cmd/get.go:397–409  ·  view source on GitHub ↗
(dst string)

Source from the content-addressed store, hash-verified

395}
396
397func createDownloadTemp(dst string) (*os.File, string, error) {
398 dir := filepath.Dir(dst)
399 base := filepath.Base(dst)
400 for i := 0; i < 100; i++ {
401 tmp := filepath.Join(dir, fmt.Sprintf(".%s.tmp-%d-%d", base, os.Getpid(), time.Now().UnixNano()+int64(i)))
402 f, err := os.OpenFile(tmp, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666)
403 if errors.Is(err, os.ErrExist) {
404 continue
405 }
406 return f, tmp, err
407 }
408 return nil, "", fmt.Errorf("failed to create temporary file for %s", dst)
409}
410
411func downloadDestinationPath(dst string) (string, error) {
412 for i := 0; i < 255; i++ {

Callers 2

downloadFileOnceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected