mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 15:02:42 +01:00
impl cache create/delete with server create/delete
also impl test connection
This commit is contained in:
19
app/util/fs.ts
Normal file
19
app/util/fs.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import RNFS from 'react-native-fs'
|
||||
|
||||
export async function mkdir(path: string): Promise<void> {
|
||||
const exists = await RNFS.exists(path)
|
||||
if (exists) {
|
||||
const isDir = (await RNFS.stat(path)).isDirectory()
|
||||
if (!isDir) {
|
||||
throw new Error(`path exists and is not a directory: ${path}`)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return await RNFS.mkdir(path)
|
||||
}
|
||||
|
||||
export async function rmdir(path: string): Promise<void> {
|
||||
return RNFS.unlink(path)
|
||||
}
|
||||
Reference in New Issue
Block a user