While building Buttercup password manager, I was constantly looking for a suitable method to allow me to store my archive files so that they would be accessible on each device that I use. As I was already using free, self-hosted cloud storage options like Nextcloud, this seemed like the obvious method to try first.
Like several cloud storage solutions, Nextcloud supports WebDAV as a means of accessing files remotely. WebDAV is quite a mature and commonplace protocol that allows for easy integration amongst synchronization and file-storage tools. It’s also quite easy to implement client applications (from existing libraries or from scratch), depending on the use case.
Finally, WebDAV is a web-based protocol that runs over the top of HTTP, and can even be setup as a server using Apache, for example. This makes it lightweight and easily accessible to simple JavaScript applications for desktop or mobile platforms.
For all of these reasons and more, WebDAV seemed like the best possible choice to start with in terms of password archive storage for Buttercup. At the time I didn’t find any particularly appealing libraries to use, so I wrote my own.
WebDAV-fs is a NodeJS WebDAV client that provides many methods for interacting with WebDAV servers. The fs in the title denotes that the library is intended to resemble Node’s fs module, and it implements some of its most-used methods:
readFile: Read a remote file on a WebDAV server – fetches the content asynchronously.
writeFile: Write to a remote file.
stat: Fetch statistics of a file.
mkdir: Create a directory.
readdir: Read the contents of a directory.
rename: Rename a remote file or directory.
unlink: Delete a remote file or directory.
Synchronous methods are obviously not supported due to the necessity of making RESTful requests.
WebDAV-fs began its life as its own project but was eventually split into two, branching off of the new WebDAV-client. The newer WebDAV-client project provides basically the same functionality, just with a more async-friendly API.
# You can install webdav-client from npm by running the following in your project:
npm install webdav --save
It’s clear to see just how simple it is reading from a remote server when you’re using WebDAV-client with Nextcloud, for instance. Here’s an example that reads a directory on a Nextcloud demo server:
This example asynchronously fetches the contents of the root of the Nextcloud server and logs all of the files and directories contained within. File explorers (that allow for the choosing of files) can be easily implemented around such a method as getDirectoryContents.
Applications like Buttercup can then very easily use tools such as this to read and write files remotely:
The benefit to using WebDAV-fs over WebDAV-client is that because it resembles the NodeJS fs API, the two can usually be used interchangeably if the application is designed for such work. Switching between local and remote files such as Buttercup does is made easy by the resemblance.
What was even more important for me when writing these tools was the ability to continue accessing storages like Nextcloud when working in the browser instead of NodeJS. Transpiling these libraries for use in the browser (with tools like webpack & browserify) works very well, and the final script is of reasonable size. At the core of webdav-client is node-fetch which provides the fetch method in both NodeJS and browser environments.
After some weeks of building and testing these libraries I discovered that quite a number of services and applications support WebDAV:
Nextcloud and of course the previous project of the Nextclouders, ownCloud
That’s already a great amount of coverage, and all under one single dependency!
So if you want to provide people with an easy way to store files in their webDAV compatible cloud storage from within your JS application, WebDAV-fs is your friend.
Nextcloud Hub 9 vous permet de rester connecté. Découvrez de nouvelles fonctionnalités de fédération, l'automatisation des flux de travail, une refonte du design et bien plus encore dans votre plateforme de collaboration open-source préférée !
Les organisations, petites et grandes, ont besoin d'un moyen d'assurer la résilience et la souveraineté numérique de leurs opérations - une alternative à Teams, open-source et respectueuse de la vie privée. Aujourd'hui, nous vous présentons cette solution - Nextcloud Talk.
Nous vous présentons une mise à jour majeure de l'assistant Nextcloud IA, ainsi que de nouvelles informations sur notre collaboration avec plusieurs grands fournisseurs d'hébergement tels que IONOS et OVHcloud pour vous proposer des options d'IA en tant que service !
Bechtle et Nextcloud ont annoncé aujourd'hui une plateforme de collaboration entièrement administrée pour le secteur public, qui ne nécessite pas d'appel d'offres et peut être déployée immédiatement.
Découvrez comment passer de ownCloud à Nextcloud. Notre outil d'aide à la migration fournit des informations sur le processus de migration et vous aide à effectuer la transition en douceur.
Au cours de la dernière année, l'IA est devenue un sujet à la mode. Il y a de l'engouement, mais aussi du fondement. Il y a du positif et du négatif. Nous voulons vous offrir le positif, pas le négatif, et ignorer le battage médiatique ! […]
As the #NextcloudConf24 is just around the corner, we would like to additionally present you with the full program for the weekend. From our keynote speakers and panelists, to live podcasting, lightning talks and workshops, we have a full agenda booked that we cannot wait to experience with you!
Nous enregistrons certains cookies pour compter les visiteurs et faciliter l'utilisation du site. Ces données ne quittent pas notre serveur et ne sont pas destinées à vous suivre personnellement ! Consultez notre politique de confidentialité pour plus d'informations Personnaliser
Les cookies utilisés pour enregistrer les données saisies dans les formulaires, telles que le nom, l'adresse électronique, le numéro de téléphone et la langue préférée.
nc_form_fields
Mémorise les données saisies dans les formulaires pour une prochaine visite (nom, adresse électronique, numéro de téléphone et langue préférée).
Les cookies statistiques collectent des informations de manière anonyme et nous aident à comprendre comment nos visiteurs utilisent notre site web. Nous utilisons la solution open source de mesure de statistiques web Matomo
Matomo
_pk_ses*: Compte la première visite de l'utilisateur
_pk_id*: Aide à ne pas compter deux fois les visites.
mtm_cookie_consent: Se souvient que l'utilisateur a donné son accord pour le stockage et l'utilisation de cookies.
_pk_ses*: 30 minutes
_pk_id*: 28 jours
mtm_cookie_consent: 30 jours