impl cache create/delete with server create/delete

also impl test connection
This commit is contained in:
austinried
2021-08-18 12:11:44 +09:00
parent 52223e6979
commit b7a05ca955
10 changed files with 288 additions and 145 deletions

19
app/util/fs.ts Normal file
View 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)
}

View File

@@ -1,7 +0,0 @@
import RNFS from 'react-native-fs'
export default {
imageCache: `${RNFS.DocumentDirectoryPath}/image_cache`,
songCache: `${RNFS.DocumentDirectoryPath}/song_cache`,
songs: `${RNFS.DocumentDirectoryPath}/songs`,
}