@umituz/react-native-filesystem 1.2.3 → 1.2.4
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/package.json +1 -1
- package/src/infrastructure/services/directory.service.ts +3 -13
- package/src/infrastructure/services/download.service.ts +1 -1
- package/src/infrastructure/services/encoding.service.ts +4 -2
- package/src/infrastructure/services/file-info.service.ts +1 -1
- package/src/infrastructure/services/file-manager.service.ts +1 -1
- package/src/infrastructure/services/file-reader.service.ts +2 -2
- package/src/infrastructure/services/file-writer.service.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-filesystem",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Domain-Driven Design filesystem utilities for React Native apps with build-time module loading and runtime file operations",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Single Responsibility: Manage directory operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import * as FileSystem from "expo-file-system";
|
|
6
|
+
import * as FileSystem from "expo-file-system/legacy";
|
|
7
7
|
import type { DirectoryType } from "../../domain/entities/File";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -37,19 +37,9 @@ export function getDirectoryPath(type: DirectoryType): string {
|
|
|
37
37
|
try {
|
|
38
38
|
switch (type) {
|
|
39
39
|
case "documentDirectory":
|
|
40
|
-
|
|
41
|
-
if ((FileSystem as any).Paths?.document?.uri) {
|
|
42
|
-
return (FileSystem as any).Paths.document.uri;
|
|
43
|
-
}
|
|
44
|
-
// Fallback for older versions
|
|
45
|
-
return (FileSystem as any).documentDirectory || "";
|
|
40
|
+
return FileSystem.documentDirectory || "";
|
|
46
41
|
case "cacheDirectory":
|
|
47
|
-
|
|
48
|
-
if ((FileSystem as any).Paths?.cache?.uri) {
|
|
49
|
-
return (FileSystem as any).Paths.cache.uri;
|
|
50
|
-
}
|
|
51
|
-
// Fallback for older versions
|
|
52
|
-
return (FileSystem as any).cacheDirectory || "";
|
|
42
|
+
return FileSystem.cacheDirectory || "";
|
|
53
43
|
default:
|
|
54
44
|
return "";
|
|
55
45
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Single Responsibility: Download files from URLs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import * as FileSystem from "expo-file-system";
|
|
6
|
+
import * as FileSystem from "expo-file-system/legacy";
|
|
7
7
|
import type { FileOperationResult } from "../../domain/entities/File";
|
|
8
8
|
import { getDirectoryPath } from "./directory.service";
|
|
9
9
|
import { FileUtils } from "../../domain/entities/File";
|
|
@@ -7,9 +7,11 @@ import type { FileEncoding } from "../../domain/entities/File";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Convert FileEncoding to Expo FileSystem encoding type
|
|
10
|
-
*
|
|
10
|
+
* Legacy API uses EncodingType enum
|
|
11
11
|
*/
|
|
12
|
-
export function getEncodingType(encoding: FileEncoding):
|
|
12
|
+
export function getEncodingType(encoding: FileEncoding): any {
|
|
13
|
+
// Legacy API uses EncodingType enum
|
|
14
|
+
// Return as string for compatibility
|
|
13
15
|
return encoding;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Single Responsibility: Read files from device storage
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import * as FileSystem from "expo-file-system";
|
|
6
|
+
import * as FileSystem from "expo-file-system/legacy";
|
|
7
7
|
import type { FileEncoding } from "../../domain/entities/File";
|
|
8
8
|
import { getEncodingType } from "./encoding.service";
|
|
9
9
|
|
|
@@ -17,7 +17,7 @@ export async function readFile(
|
|
|
17
17
|
try {
|
|
18
18
|
const encodingType = getEncodingType(encoding);
|
|
19
19
|
const content = await FileSystem.readAsStringAsync(uri, {
|
|
20
|
-
encoding: encodingType,
|
|
20
|
+
encoding: encodingType as FileSystem.EncodingType,
|
|
21
21
|
});
|
|
22
22
|
return content;
|
|
23
23
|
} catch (error) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Single Responsibility: Write files to device storage
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import * as FileSystem from "expo-file-system";
|
|
6
|
+
import * as FileSystem from "expo-file-system/legacy";
|
|
7
7
|
import type { FileEncoding, FileOperationResult } from "../../domain/entities/File";
|
|
8
8
|
import { getEncodingType } from "./encoding.service";
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ export async function writeFile(
|
|
|
18
18
|
try {
|
|
19
19
|
const encodingType = getEncodingType(encoding);
|
|
20
20
|
await FileSystem.writeAsStringAsync(uri, content, {
|
|
21
|
-
encoding: encodingType,
|
|
21
|
+
encoding: encodingType as FileSystem.EncodingType,
|
|
22
22
|
});
|
|
23
23
|
return { success: true, uri };
|
|
24
24
|
} catch (error) {
|