webdav-server is a robust and highly configurable WebDAV server implementation for Node.js, currently stable at version 2.6.2. It allows developers to create a WebDAV endpoint capable of serving various types of resources, including physical files and folders from a hard drive, in-memory virtual resources, dynamically processed/computed content, and entirely custom resource types, all within a single server instance. The project maintains an active release cadence with frequent updates, as seen with multiple patch and minor releases since its major version 2.0.0. Key differentiators include its flexible architecture that supports custom user managers, resource types, HTTP methods, and server state persistence, making it suitable for diverse applications from human-readable content management via WebDAV clients to inter-program information sharing with temporary file systems. It adheres strictly to RFC4918.
npm install webdav-serverVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up a basic WebDAV server with a physical file system mounted at `/physical`, listening on port 8080, and includes graceful shutdown.
Review the official changelog and examples for version 2.x to adapt your codebase. Pay close attention to how request bodies are accessed and how custom properties are managed.
Implement custom user managers and authentication/authorization middleware using `server.beforeRequest` or `server.afterRequest` hooks. Carefully validate paths and permissions for all operations on physical resources.
Always provide an absolute path to `PhysicalFileSystem`, ideally resolved using `path.resolve(__dirname, 'your_data_folder')` to ensure consistency and prevent directory traversal vulnerabilities.
Implement an authentication manager using `server.setUserManager()` and apply authorization logic within your custom resource definitions or through middleware hooks provided by the server.
If encountering client compatibility issues, try adjusting the `strictMode` option or reviewing its impact on specific WebDAV methods. Consult client documentation for expected server behavior.
Change the `port` option when creating your `WebDAVServer` instance to an available port (e.g., 8081), or identify and terminate the process currently using the desired port.
Ensure that the root path provided to `new PhysicalFileSystem()` is always a valid, absolute string. Use `path.resolve(__dirname, 'your-webdav-root')` to guarantee an absolute path.
Verify that your `UserManager` and `PrivilegeManager` (if implemented) grant the necessary permissions. Ensure the target resource correctly implements the desired WebDAV methods. Check if the client is expecting a file when it's a folder, or vice-versa.
No dependency data recorded yet.