Compare commits

..

No commits in common. "ac68467806269cb3d75e5b2fd6bd12a27ffc64c7" and "825167af68e75e8647ece8734e93b60014d760f3" have entirely different histories.

3 changed files with 5 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartwebdav",
"version": "1.1.2",
"version": "1.1.1",
"private": false,
"description": "A TypeScript library for easy interaction with WebDAV servers, including file and directory management.",
"main": "dist_ts/index.js",

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartwebdav',
version: '1.1.2',
version: '1.1.1',
description: 'A TypeScript library for easy interaction with WebDAV servers, including file and directory management.'
}

View File

@ -1,4 +1,3 @@
import type { isFile } from '@push.rocks/smartpath/dist_ts/smartpath.check.js';
import * as plugins from './plugins.js';
export interface IWebdavClientOptions {
@ -114,11 +113,9 @@ export class WebdavClient {
}
public async deleteFile(pathArg: string, checkNotDirectory = true) {
if (!(await this.wdClient.exists(pathArg))) {
throw new Error(`Path does not exist`);
}
if (checkNotDirectory && (await this.isDirecory(pathArg))) {
throw new Error(`Path is a directory, not a file`);
const stat = (await this.wdClient.stat(pathArg)) as plugins.webdav.FileStat;
if (checkNotDirectory && stat.type === 'directory') {
throw new Error(`Cannot delete a directory using deleteFile method. Use deleteDirectory instead.`);
}
await this.wdClient.deleteFile(pathArg);
}
@ -126,14 +123,4 @@ export class WebdavClient {
public async deleteDirectory(pathArg: string) {
await this.deleteFile(pathArg, false);
}
public async isFile(pathArg: string) {
const stat = (await this.wdClient.stat(pathArg)) as plugins.webdav.FileStat;
return stat.type === 'file';
}
public async isDirecory(pathArg: string) {
const stat = (await this.wdClient.stat(pathArg)) as plugins.webdav.FileStat;
return stat.type === 'directory';
}
}