How to use the webdav.setFetchMethod function in webdav

To help you get started, we’ve selected a few webdav examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github subdavis / Tusk / services / webdavFileManager.js View on Github external
async function searchServer(serverId) {
		let serverInfo = await getServer(serverId)
		if (serverInfo === null) {
			console.error("serverInfo not found");
			return
		}
		let client = createClient(serverInfo.url, serverInfo.username, serverInfo.password)
		createClient.setFetchMethod(window.fetch);

		/** 
		 * returns Object:[]DirInfo
		*/
		let bfs = async function () {
			let queue = ['/']
			let foundDirectories = []

			while (queue.length) {
				let path = queue.shift()

				// TODO: Implement depth better
				if (path.split('/').length > SEARCH_DEPTH)
					break; // We've exceeded search depth
				let contents = await client.getDirectoryContents(path, { credentials: 'omit' });
				let foundKDBXInDir = false;
github subdavis / Tusk / services / webdavFileManager.js View on Github external
return getServer(serverId).then(serverInfo => {
			if (serverInfo === null)
				return []
			let client = createClient(serverInfo.url, serverInfo.username, serverInfo.password)
			createClient.setFetchMethod(window.fetch);
			return client.getDirectoryContents(directory, { credentials: 'omit' }).then(contents => {
				// map from directory contents to DBInfo type.
				return contents.filter(element => {
					return element.filename.indexOf('.kdbx') >= 1
				}).map(element => {
					return {
						title: element.basename,
						path: element.filename,
						serverId: serverId
					}
				})
			})
		})
	}
github subdavis / Tusk / services / webdavFileManager.js View on Github external
function addServer(url, username, password) {
		let client = createClient(url, username, password)
		createClient.setFetchMethod((a, b) => {
			return window.fetch(a, b);
		})
		return client.getDirectoryContents('/', { credentials: 'omit' }).then(contents => {
			// success!
			let serverInfo = {
				url: url,
				username: username,
				password: password
			}
			return settings.getSetWebdavServerList().then(serverList => {
				serverList = serverList.length ? serverList : []
				let matches = serverList.filter((elem, i, a) => {
					return (elem.url == serverInfo.url
						&& elem.username == serverInfo.username
						&& elem.password == serverInfo.password)
				})
github perry-mitchell / webdav-fs / source / index.js View on Github external
createWebDAVfs.setFetchMethod = function setFetchMethod(fetchFn) {
    createWebDAVClient.setFetchMethod(fetchFn);
};

webdav

WebDAV client for NodeJS

MIT
Latest version published 3 days ago

Package Health Score

80 / 100
Full package analysis