@unvired/react-native-unvired-sdk 0.0.14 → 0.0.15

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/BuildNo.txt CHANGED
@@ -1 +1 @@
1
- R-0.000.0014
1
+ R-0.000.0015
@@ -1,9 +1,63 @@
1
- import { BaseFileSystem } from './BaseFileSystem';
1
+ import { IFileEntry, FileSystemEncoding } from './FileSystem.types';
2
2
  /**
3
3
  * FileSystem class
4
- * Extends BaseFileSystem
4
+ * Handles file system operations for React Native
5
+ * - iOS/Android/Windows: Uses @dr.pogodin/react-native-fs
6
+ * - Web: Limited functionality (not supported)
5
7
  */
6
- export declare class FileSystem extends BaseFileSystem {
8
+ export declare class FileSystem {
9
+ /**
10
+ * Get document directory path
11
+ */
12
+ static getDocumentDirectory(): string;
13
+ /**
14
+ * Resolve local file system URL
15
+ */
16
+ static resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
17
+ /**
18
+ * Get folder based on user ID
19
+ */
20
+ static getFolderBasedOnUserId(userId: string): Promise<string>;
21
+ /**
22
+ * Delete user folder
23
+ */
24
+ static deleteUserFolder(userId: string): Promise<void>;
25
+ /**
26
+ * Create directory
27
+ */
28
+ static createDirectory(path: string): Promise<void>;
29
+ /**
30
+ * Read file content
31
+ */
32
+ static readFile(path: string, encoding?: FileSystemEncoding): Promise<string>;
33
+ /**
34
+ * Write file content
35
+ */
36
+ static writeFile(path: string, content: string, encoding?: FileSystemEncoding): Promise<void>;
37
+ /**
38
+ * Delete file
39
+ */
40
+ static deleteFile(path: string): Promise<void>;
41
+ /**
42
+ * Check if file exists
43
+ */
44
+ static exists(path: string): Promise<boolean>;
45
+ /**
46
+ * Get file info
47
+ */
48
+ static stat(path: string): Promise<any>;
49
+ /**
50
+ * List directory contents
51
+ */
52
+ static readDir(path: string): Promise<any[]>;
53
+ /**
54
+ * Copy file
55
+ */
56
+ static copyFile(source: string, destination: string): Promise<void>;
57
+ /**
58
+ * Move file
59
+ */
60
+ static moveFile(source: string, destination: string): Promise<void>;
7
61
  }
8
62
  export type { IFileEntry } from './FileSystem.types';
9
63
  export default FileSystem;
@@ -1,11 +1,164 @@
1
- // FileSystem.ts
2
- // Main file system export
3
- import { BaseFileSystem } from './BaseFileSystem';
1
+ import { Platform } from 'react-native';
2
+ import { FileSystemNative } from './services/FileSystemNative';
3
+ import { FileSystemWeb } from './services/FileSystemWeb';
4
+ // Select file system implementation based on platform
5
+ const fsImpl = Platform.OS === 'web' ? new FileSystemWeb() : new FileSystemNative();
4
6
  /**
5
7
  * FileSystem class
6
- * Extends BaseFileSystem
8
+ * Handles file system operations for React Native
9
+ * - iOS/Android/Windows: Uses @dr.pogodin/react-native-fs
10
+ * - Web: Limited functionality (not supported)
7
11
  */
8
- export class FileSystem extends BaseFileSystem {
12
+ export class FileSystem {
13
+ /**
14
+ * Get document directory path
15
+ */
16
+ static getDocumentDirectory() {
17
+ return fsImpl.getDocumentDirectory();
18
+ }
19
+ /**
20
+ * Resolve local file system URL
21
+ */
22
+ static async resolveLocalFileSystemURL(url) {
23
+ try {
24
+ return await fsImpl.resolveLocalFileSystemURL(url);
25
+ }
26
+ catch (error) {
27
+ console.error('Error resolving file system URL:', error);
28
+ throw error;
29
+ }
30
+ }
31
+ /**
32
+ * Get folder based on user ID
33
+ */
34
+ static async getFolderBasedOnUserId(userId) {
35
+ try {
36
+ return await fsImpl.getFolderBasedOnUserId(userId);
37
+ }
38
+ catch (error) {
39
+ console.error('Error getting user folder:', error);
40
+ throw error;
41
+ }
42
+ }
43
+ /**
44
+ * Delete user folder
45
+ */
46
+ static async deleteUserFolder(userId) {
47
+ try {
48
+ await fsImpl.deleteUserFolder(userId);
49
+ }
50
+ catch (error) {
51
+ console.error('Error deleting user folder:', error);
52
+ throw error;
53
+ }
54
+ }
55
+ /**
56
+ * Create directory
57
+ */
58
+ static async createDirectory(path) {
59
+ try {
60
+ await fsImpl.createDirectory(path);
61
+ }
62
+ catch (error) {
63
+ console.error('Error creating directory:', error);
64
+ throw error;
65
+ }
66
+ }
67
+ /**
68
+ * Read file content
69
+ */
70
+ static async readFile(path, encoding = 'utf8') {
71
+ try {
72
+ return await fsImpl.readFile(path, encoding);
73
+ }
74
+ catch (error) {
75
+ console.error('Error reading file:', error);
76
+ throw error;
77
+ }
78
+ }
79
+ /**
80
+ * Write file content
81
+ */
82
+ static async writeFile(path, content, encoding = 'utf8') {
83
+ try {
84
+ await fsImpl.writeFile(path, content, encoding);
85
+ }
86
+ catch (error) {
87
+ console.error('Error writing file:', error);
88
+ throw error;
89
+ }
90
+ }
91
+ /**
92
+ * Delete file
93
+ */
94
+ static async deleteFile(path) {
95
+ try {
96
+ await fsImpl.deleteFile(path);
97
+ }
98
+ catch (error) {
99
+ console.error('Error deleting file:', error);
100
+ throw error;
101
+ }
102
+ }
103
+ /**
104
+ * Check if file exists
105
+ */
106
+ static async exists(path) {
107
+ try {
108
+ return await fsImpl.exists(path);
109
+ }
110
+ catch (error) {
111
+ return false;
112
+ }
113
+ }
114
+ /**
115
+ * Get file info
116
+ */
117
+ static async stat(path) {
118
+ try {
119
+ return await fsImpl.stat(path);
120
+ }
121
+ catch (error) {
122
+ console.error('Error getting file stats:', error);
123
+ throw error;
124
+ }
125
+ }
126
+ /**
127
+ * List directory contents
128
+ */
129
+ static async readDir(path) {
130
+ try {
131
+ return await fsImpl.readDir(path);
132
+ }
133
+ catch (error) {
134
+ console.error('Error reading directory:', error);
135
+ throw error;
136
+ }
137
+ }
138
+ /**
139
+ * Copy file
140
+ */
141
+ static async copyFile(source, destination) {
142
+ try {
143
+ await fsImpl.copyFile(source, destination);
144
+ }
145
+ catch (error) {
146
+ console.error('Error copying file:', error);
147
+ throw error;
148
+ }
149
+ }
150
+ /**
151
+ * Move file
152
+ */
153
+ static async moveFile(source, destination) {
154
+ try {
155
+ await fsImpl.moveFile(source, destination);
156
+ }
157
+ catch (error) {
158
+ console.error('Error moving file:', error);
159
+ throw error;
160
+ }
161
+ }
9
162
  }
10
163
  // Default export
11
164
  export default FileSystem;
@@ -1,11 +1,41 @@
1
1
  /**
2
2
  * File entry interface
3
3
  */
4
+ export interface IDirectoryReader {
5
+ readEntries(successCallback: (entries: IFileEntry[]) => void, errorCallback: (error: any) => void): void;
6
+ }
4
7
  export interface IFileEntry {
5
8
  isFile: boolean;
6
9
  isDirectory: boolean;
7
10
  name: string;
8
11
  fullPath: string;
9
12
  filesystem?: any;
10
- nativeURL?: string;
13
+ nativeURL: string;
14
+ remove(callback: () => void, errorCallback: (error: any) => void): void;
15
+ removeRecursively(callback: () => void, errorCallback: (error: any) => void): void;
16
+ createReader(): IDirectoryReader;
17
+ getDirectory?(path: string, options: {
18
+ create: boolean;
19
+ }, callback: (entry: IFileEntry) => void, errorCallback: (error: any) => void): void;
20
+ getFile?(path: string, options: {
21
+ create: boolean;
22
+ }, callback: (entry: IFileEntry) => void, errorCallback: (error: any) => void): void;
23
+ file?(callback: (file: any) => void, errorCallback: (error: any) => void): void;
24
+ createWriter?(callback: (writer: any) => void, errorCallback: (error: any) => void): void;
25
+ }
26
+ export type FileSystemEncoding = 'utf8' | 'ascii' | 'base64';
27
+ export interface IFileSystem {
28
+ getDocumentDirectory(): string;
29
+ resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
30
+ getFolderBasedOnUserId(userId: string): Promise<string>;
31
+ deleteUserFolder(userId: string): Promise<void>;
32
+ createDirectory(path: string): Promise<void>;
33
+ readFile(path: string, encoding?: FileSystemEncoding): Promise<string>;
34
+ writeFile(path: string, content: string, encoding?: FileSystemEncoding): Promise<void>;
35
+ deleteFile(path: string): Promise<void>;
36
+ exists(path: string): Promise<boolean>;
37
+ stat(path: string): Promise<any>;
38
+ readDir(path: string): Promise<any[]>;
39
+ copyFile(source: string, destination: string): Promise<void>;
40
+ moveFile(source: string, destination: string): Promise<void>;
11
41
  }
@@ -0,0 +1,26 @@
1
+ import { IFileEntry, IDirectoryReader } from './FileSystem.types';
2
+ export declare class RNFileEntry implements IFileEntry {
3
+ isFile: boolean;
4
+ isDirectory: boolean;
5
+ name: string;
6
+ fullPath: string;
7
+ nativeURL: string;
8
+ filesystem: any;
9
+ constructor(isFile: boolean, isDirectory: boolean, name: string, fullPath: string, nativeURL: string, filesystem?: any);
10
+ remove(successCallback: () => void, errorCallback: (error: any) => void): void;
11
+ removeRecursively(successCallback: () => void, errorCallback: (error: any) => void): void;
12
+ createReader(): IDirectoryReader;
13
+ getDirectory(path: string, options: {
14
+ create: boolean;
15
+ }, successCallback: (entry: IFileEntry) => void, errorCallback: (error: any) => void): void;
16
+ getFile(path: string, options: {
17
+ create: boolean;
18
+ }, successCallback: (entry: IFileEntry) => void, errorCallback: (error: any) => void): void;
19
+ file(callback: (file: any) => void, errorCallback: (error: any) => void): void;
20
+ createWriter(callback: (writer: any) => void, errorCallback: (error: any) => void): void;
21
+ }
22
+ export declare class RNDirectoryReader implements IDirectoryReader {
23
+ private localPath;
24
+ constructor(localPath: string);
25
+ readEntries(successCallback: (entries: IFileEntry[]) => void, errorCallback: (error: any) => void): void;
26
+ }
@@ -0,0 +1,114 @@
1
+ import * as RNFS from '@dr.pogodin/react-native-fs';
2
+ export class RNFileEntry {
3
+ constructor(isFile, isDirectory, name, fullPath, nativeURL, filesystem = null) {
4
+ this.isFile = isFile;
5
+ this.isDirectory = isDirectory;
6
+ this.name = name;
7
+ this.fullPath = fullPath;
8
+ this.nativeURL = nativeURL;
9
+ this.filesystem = filesystem;
10
+ }
11
+ remove(successCallback, errorCallback) {
12
+ RNFS.unlink(this.fullPath)
13
+ .then(() => successCallback())
14
+ .catch((err) => errorCallback(err));
15
+ }
16
+ removeRecursively(successCallback, errorCallback) {
17
+ this.remove(successCallback, errorCallback);
18
+ }
19
+ createReader() {
20
+ return new RNDirectoryReader(this.fullPath);
21
+ }
22
+ getDirectory(path, options, successCallback, errorCallback) {
23
+ const newPath = this.fullPath + (this.fullPath.endsWith('/') ? '' : '/') + path;
24
+ const newNativeURL = "file://" + newPath;
25
+ if (options.create) {
26
+ RNFS.mkdir(newPath).then(() => {
27
+ successCallback(new RNFileEntry(false, true, path, newPath, newNativeURL));
28
+ }).catch(errorCallback);
29
+ }
30
+ else {
31
+ RNFS.stat(newPath).then(stat => {
32
+ if (stat.isDirectory()) {
33
+ successCallback(new RNFileEntry(false, true, path, newPath, newNativeURL));
34
+ }
35
+ else {
36
+ errorCallback("Not a directory");
37
+ }
38
+ }).catch(errorCallback);
39
+ }
40
+ }
41
+ getFile(path, options, successCallback, errorCallback) {
42
+ const newPath = this.fullPath + (this.fullPath.endsWith('/') ? '' : '/') + path;
43
+ const newNativeURL = "file://" + newPath;
44
+ if (options.create) {
45
+ RNFS.exists(newPath).then(exists => {
46
+ if (exists) {
47
+ successCallback(new RNFileEntry(true, false, path, newPath, newNativeURL));
48
+ }
49
+ else {
50
+ RNFS.writeFile(newPath, '', 'utf8').then(() => {
51
+ successCallback(new RNFileEntry(true, false, path, newPath, newNativeURL));
52
+ }).catch(errorCallback);
53
+ }
54
+ }).catch(errorCallback);
55
+ }
56
+ else {
57
+ RNFS.stat(newPath).then(stat => {
58
+ if (stat.isFile()) {
59
+ successCallback(new RNFileEntry(true, false, path, newPath, newNativeURL));
60
+ }
61
+ else {
62
+ errorCallback("Not a file");
63
+ }
64
+ }).catch(errorCallback);
65
+ }
66
+ }
67
+ file(callback, errorCallback) {
68
+ RNFS.stat(this.fullPath).then(stat => {
69
+ const file = {
70
+ name: stat.name,
71
+ localURL: "file://" + stat.path,
72
+ type: "",
73
+ lastModified: stat.mtime ? new Date(stat.mtime).getTime() : 0,
74
+ lastModifiedDate: stat.mtime,
75
+ size: stat.size,
76
+ start: 0,
77
+ end: stat.size,
78
+ slice: () => { }
79
+ };
80
+ callback(file);
81
+ }).catch(errorCallback);
82
+ }
83
+ createWriter(callback, errorCallback) {
84
+ const writer = {
85
+ write: (data) => {
86
+ RNFS.writeFile(this.fullPath, data, 'utf8')
87
+ .then(() => { if (writer.onwriteend)
88
+ writer.onwriteend(); })
89
+ .catch((err) => { if (writer.onerror)
90
+ writer.onerror(err); });
91
+ },
92
+ seek: () => { },
93
+ truncate: () => { },
94
+ onwriteend: null,
95
+ onerror: null
96
+ };
97
+ callback(writer);
98
+ }
99
+ }
100
+ export class RNDirectoryReader {
101
+ constructor(localPath) {
102
+ this.localPath = localPath;
103
+ }
104
+ readEntries(successCallback, errorCallback) {
105
+ RNFS.readDir(this.localPath)
106
+ .then((result) => {
107
+ const entries = result.map(fileStat => {
108
+ return new RNFileEntry(fileStat.isFile(), fileStat.isDirectory(), fileStat.name || fileStat.path.split('/').pop() || '', fileStat.path, "file://" + fileStat.path);
109
+ });
110
+ successCallback(entries);
111
+ })
112
+ .catch((err) => errorCallback(err));
113
+ }
114
+ }
@@ -1,3 +1,3 @@
1
1
  export { FileSystem } from './FileSystem';
2
- export type { IFileEntry } from './FileSystem.types';
2
+ export type { IFileEntry, IDirectoryReader } from './FileSystem.types';
3
3
  export { default } from './FileSystem';
@@ -1,13 +1,13 @@
1
1
  import * as RNFS from '@dr.pogodin/react-native-fs';
2
- import { IFileEntry } from '../FileSystem.types';
3
- export declare class FileSystemNative {
2
+ import { IFileEntry, IFileSystem, FileSystemEncoding } from '../FileSystem.types';
3
+ export declare class FileSystemNative implements IFileSystem {
4
4
  getDocumentDirectory(): string;
5
5
  resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
6
6
  getFolderBasedOnUserId(userId: string): Promise<string>;
7
7
  deleteUserFolder(userId: string): Promise<void>;
8
8
  createDirectory(path: string): Promise<void>;
9
- readFile(path: string, encoding?: RNFS.EncodingT): Promise<string>;
10
- writeFile(path: string, content: string, encoding?: RNFS.EncodingT): Promise<void>;
9
+ readFile(path: string, encoding?: FileSystemEncoding): Promise<string>;
10
+ writeFile(path: string, content: string, encoding?: FileSystemEncoding): Promise<void>;
11
11
  deleteFile(path: string): Promise<void>;
12
12
  exists(path: string): Promise<boolean>;
13
13
  stat(path: string): Promise<RNFS.StatResultT>;
@@ -1,4 +1,5 @@
1
1
  import * as RNFS from '@dr.pogodin/react-native-fs';
2
+ import { RNFileEntry } from '../RNFileEntry';
2
3
  export class FileSystemNative {
3
4
  getDocumentDirectory() {
4
5
  return RNFS.DocumentDirectoryPath;
@@ -14,13 +15,7 @@ export class FileSystemNative {
14
15
  }
15
16
  const stat = await RNFS.stat(normalizedPath);
16
17
  const fileName = stat.name || normalizedPath.split('/').pop() || 'unknown';
17
- return {
18
- isFile: stat.isFile(),
19
- isDirectory: stat.isDirectory(),
20
- name: fileName,
21
- fullPath: stat.path,
22
- nativeURL: `file://${stat.path}`,
23
- };
18
+ return new RNFileEntry(stat.isFile(), stat.isDirectory(), fileName, stat.path, `file://${stat.path}`);
24
19
  }
25
20
  async getFolderBasedOnUserId(userId) {
26
21
  const userFolder = `${RNFS.DocumentDirectoryPath}/users/${userId}`;
@@ -1,12 +1,12 @@
1
- import { IFileEntry } from '../FileSystem.types';
2
- export declare class FileSystemWeb {
1
+ import { IFileEntry, IFileSystem, FileSystemEncoding } from '../FileSystem.types';
2
+ export declare class FileSystemWeb implements IFileSystem {
3
3
  getDocumentDirectory(): string;
4
4
  resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
5
5
  getFolderBasedOnUserId(userId: string): Promise<string>;
6
6
  deleteUserFolder(userId: string): Promise<void>;
7
7
  createDirectory(path: string): Promise<void>;
8
- readFile(path: string, encoding?: string): Promise<string>;
9
- writeFile(path: string, content: string, encoding?: string): Promise<void>;
8
+ readFile(path: string, encoding?: FileSystemEncoding): Promise<string>;
9
+ writeFile(path: string, content: string, encoding?: FileSystemEncoding): Promise<void>;
10
10
  deleteFile(path: string): Promise<void>;
11
11
  exists(path: string): Promise<boolean>;
12
12
  stat(path: string): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvired/react-native-unvired-sdk",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Unvired SDK for React Native with logging, database, notifications, and file system support",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -1,61 +0,0 @@
1
- import { IFileEntry } from './FileSystem.types';
2
- /**
3
- * Base File System Class
4
- * Handles file system operations for React Native
5
- * - iOS/Android/Windows: Uses @dr.pogodin/react-native-fs
6
- * - Web: Limited functionality (not supported)
7
- */
8
- export declare class BaseFileSystem {
9
- /**
10
- * Get document directory path
11
- */
12
- static getDocumentDirectory(): string;
13
- /**
14
- * Resolve local file system URL
15
- */
16
- static resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
17
- /**
18
- * Get folder based on user ID
19
- */
20
- static getFolderBasedOnUserId(userId: string): Promise<string>;
21
- /**
22
- * Delete user folder
23
- */
24
- static deleteUserFolder(userId: string): Promise<void>;
25
- /**
26
- * Create directory
27
- */
28
- static createDirectory(path: string): Promise<void>;
29
- /**
30
- * Read file content
31
- */
32
- static readFile(path: string, encoding?: string): Promise<string>;
33
- /**
34
- * Write file content
35
- */
36
- static writeFile(path: string, content: string, encoding?: string): Promise<void>;
37
- /**
38
- * Delete file
39
- */
40
- static deleteFile(path: string): Promise<void>;
41
- /**
42
- * Check if file exists
43
- */
44
- static exists(path: string): Promise<boolean>;
45
- /**
46
- * Get file info
47
- */
48
- static stat(path: string): Promise<any>;
49
- /**
50
- * List directory contents
51
- */
52
- static readDir(path: string): Promise<any[]>;
53
- /**
54
- * Copy file
55
- */
56
- static copyFile(source: string, destination: string): Promise<void>;
57
- /**
58
- * Move file
59
- */
60
- static moveFile(source: string, destination: string): Promise<void>;
61
- }
@@ -1,164 +0,0 @@
1
- // BaseFileSystem.ts
2
- // Base file system implementation
3
- import { Platform } from 'react-native';
4
- import { FileSystemNative } from './services/FileSystemNative';
5
- import { FileSystemWeb } from './services/FileSystemWeb';
6
- // Select file system implementation based on platform
7
- const fsImpl = Platform.OS === 'web' ? new FileSystemWeb() : new FileSystemNative();
8
- /**
9
- * Base File System Class
10
- * Handles file system operations for React Native
11
- * - iOS/Android/Windows: Uses @dr.pogodin/react-native-fs
12
- * - Web: Limited functionality (not supported)
13
- */
14
- export class BaseFileSystem {
15
- /**
16
- * Get document directory path
17
- */
18
- static getDocumentDirectory() {
19
- return fsImpl.getDocumentDirectory();
20
- }
21
- /**
22
- * Resolve local file system URL
23
- */
24
- static async resolveLocalFileSystemURL(url) {
25
- try {
26
- return await fsImpl.resolveLocalFileSystemURL(url);
27
- }
28
- catch (error) {
29
- console.error('Error resolving file system URL:', error);
30
- throw error;
31
- }
32
- }
33
- /**
34
- * Get folder based on user ID
35
- */
36
- static async getFolderBasedOnUserId(userId) {
37
- try {
38
- return await fsImpl.getFolderBasedOnUserId(userId);
39
- }
40
- catch (error) {
41
- console.error('Error getting user folder:', error);
42
- throw error;
43
- }
44
- }
45
- /**
46
- * Delete user folder
47
- */
48
- static async deleteUserFolder(userId) {
49
- try {
50
- await fsImpl.deleteUserFolder(userId);
51
- }
52
- catch (error) {
53
- console.error('Error deleting user folder:', error);
54
- throw error;
55
- }
56
- }
57
- /**
58
- * Create directory
59
- */
60
- static async createDirectory(path) {
61
- try {
62
- await fsImpl.createDirectory(path);
63
- }
64
- catch (error) {
65
- console.error('Error creating directory:', error);
66
- throw error;
67
- }
68
- }
69
- /**
70
- * Read file content
71
- */
72
- static async readFile(path, encoding = 'utf8') {
73
- try {
74
- return await fsImpl.readFile(path, encoding);
75
- }
76
- catch (error) {
77
- console.error('Error reading file:', error);
78
- throw error;
79
- }
80
- }
81
- /**
82
- * Write file content
83
- */
84
- static async writeFile(path, content, encoding = 'utf8') {
85
- try {
86
- await fsImpl.writeFile(path, content, encoding);
87
- }
88
- catch (error) {
89
- console.error('Error writing file:', error);
90
- throw error;
91
- }
92
- }
93
- /**
94
- * Delete file
95
- */
96
- static async deleteFile(path) {
97
- try {
98
- await fsImpl.deleteFile(path);
99
- }
100
- catch (error) {
101
- console.error('Error deleting file:', error);
102
- throw error;
103
- }
104
- }
105
- /**
106
- * Check if file exists
107
- */
108
- static async exists(path) {
109
- try {
110
- return await fsImpl.exists(path);
111
- }
112
- catch (error) {
113
- return false;
114
- }
115
- }
116
- /**
117
- * Get file info
118
- */
119
- static async stat(path) {
120
- try {
121
- return await fsImpl.stat(path);
122
- }
123
- catch (error) {
124
- console.error('Error getting file stats:', error);
125
- throw error;
126
- }
127
- }
128
- /**
129
- * List directory contents
130
- */
131
- static async readDir(path) {
132
- try {
133
- return await fsImpl.readDir(path);
134
- }
135
- catch (error) {
136
- console.error('Error reading directory:', error);
137
- throw error;
138
- }
139
- }
140
- /**
141
- * Copy file
142
- */
143
- static async copyFile(source, destination) {
144
- try {
145
- await fsImpl.copyFile(source, destination);
146
- }
147
- catch (error) {
148
- console.error('Error copying file:', error);
149
- throw error;
150
- }
151
- }
152
- /**
153
- * Move file
154
- */
155
- static async moveFile(source, destination) {
156
- try {
157
- await fsImpl.moveFile(source, destination);
158
- }
159
- catch (error) {
160
- console.error('Error moving file:', error);
161
- throw error;
162
- }
163
- }
164
- }