Class

NextcloudSync

NextcloudSync()

Synchronizes a file with a Nextcloud (or any WebDAV) server using HTTP Basic authentication.

WebDAV has no standard content hash, so "in sync" is determined by comparing the remote ETag and the local SHA-256 hash with the values recorded after the last successful transfer (see getSyncState(), persisted by the caller).

Constructor

# new NextcloudSync()

View Source backend/cloud_sync/nextcloud_sync.js, line 52

Extends

Methods

# async _recordSyncState()

Remember the remote ETag and local hash after a successful transfer. Falls back to a PROPFIND if the server did not send an ETag header.

View Source backend/cloud_sync/nextcloud_sync.js, line 179

# async _withRetry(apiCall, operationName, trackRetries)

Execute an API call with retry logic and exponential backoff.

Parameters:
Name Type Default Description
apiCall function

Async function that performs the API call

operationName string API call

Name of the operation for logging

trackRetries boolean false

Whether to return {result, retryCount} instead of the plain result

Overrides:

View Source backend/cloud_sync/remote_file_sync.js, line 122

# async listFolderEntries(remotePath) → {Promise.<Array.<{name: string, path: string, isFolder: boolean, size: number}>>}

List the direct children of a remote folder.

Parameters:
Name Type Description
remotePath string

folder path ('' or '/' for the root), in the same form as accepted by downloadFile()

Overrides:

View Source backend/cloud_sync/remote_file_sync.js, line 76

an error with notFound = true if the folder does not exist

path of each entry can be passed to listFolderEntries() / downloadFile() again.

Promise.<Array.<{name: string, path: string, isFolder: boolean, size: number}>>

# async refreshAccessToken()

Refresh the access credentials if the provider uses expiring tokens. No-op by default.

Overrides:

View Source backend/cloud_sync/remote_file_sync.js, line 81

# async testConnection() → {Promise.<module:backend/cloud_sync/nextcloud_sync~ConnectionTestResult>}

Check whether the server is reachable with the configured credentials.

View Source backend/cloud_sync/nextcloud_sync.js, line 206

Promise.<module:backend/cloud_sync/nextcloud_sync~ConnectionTestResult>