This repository has been archived by the owner on Sep 30, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
import ReactNative from 'react-native'; | ||
import ReactNative from 'react-native' | ||
|
||
// noinspection JSUnresolvedVariable | ||
const RNFileSystem = ReactNative.NativeModules.RNFileSystem; | ||
const RNFileSystem = ReactNative.NativeModules.RNFileSystem | ||
|
||
export default class FileSystem { | ||
|
||
static storage = { | ||
backedUp: 'BACKED_UP', | ||
important: 'IMPORTANT', | ||
auxiliary: 'AUXILIARY', | ||
temporary: 'TEMPORARY', | ||
temporary: 'TEMPORARY' | ||
}; | ||
|
||
static async writeToFile(path, contents, isAppend = false, storage = FileSystem.storage.backedUp) { | ||
return await RNFileSystem.writeToFile(path, contents, isAppend, storage); | ||
static async writeToFile (path, contents, isAppend = false, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem.writeToFile(path, contents, isAppend, storage) | ||
} | ||
|
||
static async readFile(path, storage = FileSystem.storage.backedUp) { | ||
return await RNFileSystem.readFile(path, storage); | ||
static async readFile (path, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem.readFile(path, storage) | ||
} | ||
|
||
static async delete(path, storage = FileSystem.storage.backedUp) { | ||
return await RNFileSystem.delete(path, storage); | ||
static async delete (path, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem.delete(path, storage) | ||
} | ||
|
||
static async fileExists(path, storage = FileSystem.storage.backedUp) { | ||
return await RNFileSystem.fileExists(path, storage); | ||
static async fileExists (path, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem.fileExists(path, storage) | ||
} | ||
|
||
static async directoryExists(path, storage = FileSystem.storage.backedUp) { | ||
return await RNFileSystem.directoryExists(path, storage); | ||
static async directoryExists (path, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem.directoryExists(path, storage) | ||
} | ||
|
||
static absolutePath(path, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem[storage] + '/' + path; | ||
static absolutePath (path, storage = FileSystem.storage.backedUp) { | ||
return RNFileSystem[storage] + '/' + path | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters