Skip to content
This repository was archived by the owner on Dec 30, 2023. It is now read-only.

Commit 07ebc40

Browse files
committed
feat: create helper to make directory on webdav server
1 parent b7549d1 commit 07ebc40

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/mkdir.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import path from 'path'
2+
import axios from 'axios'
3+
4+
const mkdir = async (dir, options) => {
5+
try {
6+
const url = path.join('/', dir)
7+
const method = 'mkcol'
8+
const validateStatus = status => status === 201
9+
const response = await axios({ ...options, url, method, validateStatus })
10+
return response.status === 201
11+
} catch (e) {
12+
return Promise.reject(e)
13+
}
14+
}
15+
16+
export default mkdir

0 commit comments

Comments
 (0)