code: func (a *basicDownloadAdapter) checkResumeDownload(t *Transfer) (outFile *os.File, fromByte int64, hashSoFar hash.Hash, e error) {
  	// lock the file by opening it for read/write, rather than checking Stat() etc
  	// which could be subject to race conditions by other processes
  	f, err := os.OpenFile(a.downloadFilename(t), os.O_RDWR, 0644)
  
  	if err != nil {
  		// Create a new file instead, must not already exist or error (permissions / race condition)
  		newfile, err := os.OpenFile(a.downloadFilename(t), os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0644)
  		return newfile, 0, nil, err
  	}
  
  	// Successfully opened an existing file at this point
  	// Read any existing data into hash then return file handle at end
  	hash := tools.NewLfsContentHash()
  	n, err := io.Copy(hash, f)
  	if err != nil {
  		f.Close()
  		return nil, 0, nil, err
  	}
  	tracerx.Printf("xfer: Attempting to resume download of %q from byte %d", t.Oid, n)
  	return f, n, hash, nil
  
  }
docs: // Checks to see if a download can be resumed, and if so returns a non-nil locked file, byte start and hash