Create a new folder under a given path in Nextcloud
1
import axios from "axios";
2
3
export async function main(
4
nextcloud: RT.Nextcloud,
5
path: string,
6
) {
7
8
try {
9
const res = await axios.request(
10
{
11
method: "MKCOL",
12
url: `/remote.php/dav/files/${nextcloud.userId}/${path}`,
13
baseURL: nextcloud.baseUrl,
14
headers: {
15
Authorization: `Basic ${btoa(`${nextcloud.userId}:${nextcloud.token}`)
16
}`,
17
},
18
19
);
20
return res.data;
21
} catch (e) {
22
console.log(e.response.data);
23
}
24