@epubjs-react-native/file-system 1.1.0 → 1.1.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/useFileSystem.js +10 -0
- package/dist/esm/useFileSystem.js +10 -0
- package/dist/types/types.d.ts +31 -0
- package/package.json +2 -6
|
@@ -130,6 +130,16 @@ function useFileSystem() {
|
|
|
130
130
|
size: size,
|
|
131
131
|
error: error,
|
|
132
132
|
success: success,
|
|
133
|
+
documentDirectory: react_native_fs_1.default.DocumentDirectoryPath,
|
|
134
|
+
bundleDirectory: react_native_fs_1.default.MainBundlePath,
|
|
135
|
+
cacheDirectory: react_native_fs_1.default.CachesDirectoryPath,
|
|
136
|
+
readAsStringAsync: function (fileUri, options) {
|
|
137
|
+
return react_native_fs_1.default.readFile(fileUri, options === null || options === void 0 ? void 0 : options.encoding);
|
|
138
|
+
},
|
|
139
|
+
writeAsStringAsync: function (fileUri, contents, options) {
|
|
140
|
+
return react_native_fs_1.default.writeFile(fileUri, contents, options === null || options === void 0 ? void 0 : options.encoding);
|
|
141
|
+
},
|
|
142
|
+
deleteAsync: function (fileUri) { return react_native_fs_1.default.unlink(fileUri); },
|
|
133
143
|
downloadFile: downloadFile,
|
|
134
144
|
getFileInfo: getFileInfo,
|
|
135
145
|
};
|
|
@@ -124,6 +124,16 @@ export function useFileSystem() {
|
|
|
124
124
|
size: size,
|
|
125
125
|
error: error,
|
|
126
126
|
success: success,
|
|
127
|
+
documentDirectory: RNFS.DocumentDirectoryPath,
|
|
128
|
+
bundleDirectory: RNFS.MainBundlePath,
|
|
129
|
+
cacheDirectory: RNFS.CachesDirectoryPath,
|
|
130
|
+
readAsStringAsync: function (fileUri, options) {
|
|
131
|
+
return RNFS.readFile(fileUri, options === null || options === void 0 ? void 0 : options.encoding);
|
|
132
|
+
},
|
|
133
|
+
writeAsStringAsync: function (fileUri, contents, options) {
|
|
134
|
+
return RNFS.writeFile(fileUri, contents, options === null || options === void 0 ? void 0 : options.encoding);
|
|
135
|
+
},
|
|
136
|
+
deleteAsync: function (fileUri) { return RNFS.unlink(fileUri); },
|
|
127
137
|
downloadFile: downloadFile,
|
|
128
138
|
getFileInfo: getFileInfo,
|
|
129
139
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -5,6 +5,37 @@ export type FileSystem = {
|
|
|
5
5
|
size: number;
|
|
6
6
|
error: string | null;
|
|
7
7
|
success: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* `file://` URI pointing to the directory where user documents for this app will be stored.
|
|
10
|
+
* Files stored here will remain until explicitly deleted by the app. Ends with a trailing `/`.
|
|
11
|
+
* Example uses are for files the user saves that they expect to see again.
|
|
12
|
+
*/
|
|
13
|
+
documentDirectory: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* `file://` URI pointing to the directory where temporary files used by this app will be stored.
|
|
16
|
+
* Files stored here may be automatically deleted by the system when low on storage.
|
|
17
|
+
* Example uses are for downloaded or generated files that the app just needs for one-time usage.
|
|
18
|
+
*/
|
|
19
|
+
cacheDirectory: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* URI to the directory where assets bundled with the application are stored.
|
|
22
|
+
*/
|
|
23
|
+
bundleDirectory: string | null;
|
|
24
|
+
readAsStringAsync: (fileUri: string, options?: {
|
|
25
|
+
/**
|
|
26
|
+
* The encoding format to use when reading the file.
|
|
27
|
+
* @default 'utf8'
|
|
28
|
+
*/
|
|
29
|
+
encoding?: 'utf8' | 'base64';
|
|
30
|
+
}) => Promise<string>;
|
|
31
|
+
writeAsStringAsync: (fileUri: string, contents: string, options?: {
|
|
32
|
+
/**
|
|
33
|
+
* The encoding format to use when reading the file.
|
|
34
|
+
* @default 'utf8'
|
|
35
|
+
*/
|
|
36
|
+
encoding?: 'utf8' | 'base64';
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
deleteAsync: (fileUri: string) => Promise<void>;
|
|
8
39
|
downloadFile: (fromUrl: string, toFile: string) => Promise<{
|
|
9
40
|
uri: string | null;
|
|
10
41
|
mimeType: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epubjs-react-native/file-system",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2-beta.1",
|
|
4
4
|
"description": "An file system module for epubjs-react-native library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
25
25
|
"postbuild": "npm run copy-files:cjs && npm run copy-files:esm",
|
|
26
26
|
"prerelease": "npm run lint:fix && npm run type-check && npm run test:coverage",
|
|
27
|
-
"release": "npm run build && npm publish",
|
|
27
|
+
"release": "npm run build && npm publish --tag beta",
|
|
28
28
|
"release-local": "npm run build && npm link && echo [FINISH]: Run \"npm link epubjs-react-native-file-system\" to link the package to your project"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
@@ -78,10 +78,6 @@
|
|
|
78
78
|
"ts-jest": "29.1.2",
|
|
79
79
|
"typescript": "5.4.2"
|
|
80
80
|
},
|
|
81
|
-
"engines": {
|
|
82
|
-
"yarn": ">= 1.22.0",
|
|
83
|
-
"node": ">=20.0.0"
|
|
84
|
-
},
|
|
85
81
|
"config": {
|
|
86
82
|
"commitizen": {
|
|
87
83
|
"path": "./node_modules/commitizen-emoji"
|