Compare commits

...

2 Commits

Author SHA1 Message Date
825167af68 1.1.1 2024-04-22 17:58:28 +02:00
ba559e4304 fix(core): update 2024-04-22 17:58:27 +02:00
3 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartwebdav",
"version": "1.1.0",
"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.0',
version: '1.1.1',
description: 'A TypeScript library for easy interaction with WebDAV servers, including file and directory management.'
}

View File

@ -112,7 +112,15 @@ export class WebdavClient {
await this.wdClient.moveFile(sourcePathArg, targetPathArg);
}
public async deleteDirectory(pathArg: string) {
public async deleteFile(pathArg: string, checkNotDirectory = true) {
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);
}
public async deleteDirectory(pathArg: string) {
await this.deleteFile(pathArg, false);
}
}