Registry / http-networking / webdav-client

webdav-client

JSON →
library1.4.3jsnpmunverified

webdav-client is a Node.js library offering a comprehensive, callback-based API for interacting with WebDAV servers. Currently stable at version 1.4.3, this package provides a suite of methods for common file and directory operations, including `get`, `put`, `readdir`, `mkdir`, `delete`, `move`, `copy`, alongside robust capabilities for property management (setting, removing, retrieving properties) and locking mechanisms. It also supports custom HTTP requests and stream-based data transfers for efficient handling of large files. The library is specifically designed for server-side Node.js environments and explicitly states it is not yet suitable for browser usage. Its primary differentiating factors include its direct, callback-centric programming model, which allows for fine-grained control over WebDAV protocol interactions, and its focus on Node.js compatibility. While a specific release cadence is not documented, the versioning suggests a mature and stable codebase for integrating WebDAV functionalities into Node.js applications.

npm install webdav-client
INSTALL
IMPORT
SIG · WEBDAV-CLIENT
W
webdav-client
http-networkingjavascriptv1.4.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

* as webdavClient
import * as webdavClient from 'webdav-client'
import webdavClient from 'webdav-client'
Standard namespace import for accessing all exports, where `Connection` is a property of `webdavClient`.
Connection
import { Connection } from 'webdav-client'
import Connection from 'webdav-client'
Named import for direct access to the primary `Connection` class.
Connection (CommonJS)
const webdavClient = require('webdav-client'); const connection = new webdavClient.Connection(...);
const { Connection } = require('webdav-client');
CommonJS import pattern. The `Connection` class is a property of the module object exported by `webdav-client`. Direct destructuring like `const { Connection } = require('webdav-client')` might not always yield the expected class if the module's export structure changes.

Demonstrates how to initialize the WebDAV client with optional authentication and fetch the content of a specified file using its callback-based API.

import { Connection } from 'webdav-client'; import * as path from 'path'; const webdavUrl = process.env.WEBDAV_URL ?? 'http://localhost:1900'; const webdavUser = process.env.WEBDAV_USER; const webdavPass = process.env.WEBDAV_PASS; const options = { url: webdavUrl }; if (webdavUser && webdavPass) { options.username = webdavUser; options.password = webdavPass; } const connection = new Connection(options); const filePath = '/path/of/my/file.txt'; console.log(`Attempting to fetch file '${filePath}' from ${webdavUrl}`); connection.get(filePath, (e, content) => { if (e) { console.error(`Error fetching file: ${e.message}`); // Additional error handling based on status codes (e.g., 404, 401) if (e.statusCode === 404) { console.error('File not found.'); } else if (e.statusCode === 401) { console.error('Unauthorized access. Check credentials.'); } return; } console.log(`Content of '${filePath}':\n${content.toString()}`); });
Debug
Known issues
gotchaThe `webdav-client` library is explicitly designed for Node.js environments and is not intended for use in browsers.
fix
For frontend applications, use a WebDAV client library specifically built and tested for browser compatibility.
affects: >=1.0.0
gotchaThe API exclusively uses a callback-based asynchronous pattern, which might require adaptation if your project primarily uses Promises or async/await.
fix
Wrap callback-based methods in Promises using `util.promisify` from Node.js's built-in `util` module to enable `async/await` syntax, or choose an alternative client that natively supports Promises.
affects: >=1.0.0
gotchaThe library does not include built-in retry mechanisms for transient network failures or server unavailability.
fix
Implement custom retry logic around API calls (e.g., using libraries like `p-retry` for Promises or a custom loop for callbacks) to improve resilience against intermittent connection issues.
affects: >=1.0.0
Errors
Common errors & fixes
connect ECONNREFUSED <IP>:<PORT>
The WebDAV server is not running, is inaccessible, or the specified URL/port is incorrect.
fix
Verify that the WebDAV server is operational and reachable from the client's host. Ensure the `url` provided in the `Connection` constructor is correct.
Error: Not Found (404)
The requested file or directory does not exist on the WebDAV server at the specified path.
fix
Double-check the path provided to WebDAV methods (e.g., `get`, `readdir`, `put`) for accuracy against the server's directory structure.
Error: Unauthorized (401)
The client failed to authenticate with the WebDAV server due to incorrect or missing credentials.
fix
Provide valid `username` and `password` in the `ConnectionOptions` or ensure a custom `authenticator` is correctly configured.
Upgrade
Version history
1.4.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
webdav-client — npm install webdav-client · libregistry