@uipath/filesystem 0.1.6 → 0.1.7
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/README.md +63 -63
- package/dist/index.browser.js +531 -530
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# @uipath/filesystem
|
|
2
|
-
|
|
3
|
-
Cross-platform filesystem abstraction for the UiPath CLI. Provides a unified interface for file operations in both Node.js and browser environments.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @uipath/filesystem
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { getFileSystem } from "@uipath/filesystem";
|
|
15
|
-
|
|
16
|
-
const fs = getFileSystem();
|
|
17
|
-
|
|
18
|
-
// Read a file
|
|
19
|
-
const content = await fs.readFile("config.json", "utf-8");
|
|
20
|
-
|
|
21
|
-
// Write a file (creates directories as needed)
|
|
22
|
-
await fs.writeFile("output/result.json", JSON.stringify(data));
|
|
23
|
-
|
|
24
|
-
// Path operations
|
|
25
|
-
const full = fs.path.join(fs.env.homedir(), ".uipath", "config.json");
|
|
26
|
-
|
|
27
|
-
// Check existence
|
|
28
|
-
if (await fs.exists(full)) {
|
|
29
|
-
const stats = await fs.stat(full);
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## API
|
|
34
|
-
|
|
35
|
-
### `getFileSystem()` / `getFileSystemAsync()`
|
|
36
|
-
|
|
37
|
-
Returns a singleton `IFileSystem` instance.
|
|
38
|
-
|
|
39
|
-
### IFileSystem
|
|
40
|
-
|
|
41
|
-
| Method | Description |
|
|
42
|
-
| :--- | :--- |
|
|
43
|
-
| `readFile(path, options?)` | Read file as `Uint8Array` or UTF-8 string |
|
|
44
|
-
| `writeFile(path, data)` | Write file, creating parent directories |
|
|
45
|
-
| `readdir(path)` | List directory contents |
|
|
46
|
-
| `stat(path)` | Get file stats (type, size, mtime) |
|
|
47
|
-
| `exists(path)` | Check if path exists |
|
|
48
|
-
| `mkdir(path)` | Create directory recursively |
|
|
49
|
-
| `rm(path)` | Remove file or directory recursively |
|
|
50
|
-
| `rename(old, new)` | Rename or move a file |
|
|
51
|
-
| `getTempDir()` | Create an isolated temp directory |
|
|
52
|
-
| `copyDirectory(src, dest)` | Recursive directory copy |
|
|
53
|
-
|
|
54
|
-
### Namespaces
|
|
55
|
-
|
|
56
|
-
| Namespace | Description |
|
|
57
|
-
| :--- | :--- |
|
|
58
|
-
| `fs.path` | Path operations: `join`, `resolve`, `relative`, `dirname`, `basename`, `isAbsolute` |
|
|
59
|
-
| `fs.env` | Environment: `cwd()`, `homedir()`, `tmpdir()`, `getenv(key)` |
|
|
60
|
-
|
|
61
|
-
## License
|
|
62
|
-
|
|
63
|
-
See the [root repository](https://github.com/UiPath/uipcli) for license information.
|
|
1
|
+
# @uipath/filesystem
|
|
2
|
+
|
|
3
|
+
Cross-platform filesystem abstraction for the UiPath CLI. Provides a unified interface for file operations in both Node.js and browser environments.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @uipath/filesystem
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { getFileSystem } from "@uipath/filesystem";
|
|
15
|
+
|
|
16
|
+
const fs = getFileSystem();
|
|
17
|
+
|
|
18
|
+
// Read a file
|
|
19
|
+
const content = await fs.readFile("config.json", "utf-8");
|
|
20
|
+
|
|
21
|
+
// Write a file (creates directories as needed)
|
|
22
|
+
await fs.writeFile("output/result.json", JSON.stringify(data));
|
|
23
|
+
|
|
24
|
+
// Path operations
|
|
25
|
+
const full = fs.path.join(fs.env.homedir(), ".uipath", "config.json");
|
|
26
|
+
|
|
27
|
+
// Check existence
|
|
28
|
+
if (await fs.exists(full)) {
|
|
29
|
+
const stats = await fs.stat(full);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### `getFileSystem()` / `getFileSystemAsync()`
|
|
36
|
+
|
|
37
|
+
Returns a singleton `IFileSystem` instance.
|
|
38
|
+
|
|
39
|
+
### IFileSystem
|
|
40
|
+
|
|
41
|
+
| Method | Description |
|
|
42
|
+
| :--- | :--- |
|
|
43
|
+
| `readFile(path, options?)` | Read file as `Uint8Array` or UTF-8 string |
|
|
44
|
+
| `writeFile(path, data)` | Write file, creating parent directories |
|
|
45
|
+
| `readdir(path)` | List directory contents |
|
|
46
|
+
| `stat(path)` | Get file stats (type, size, mtime) |
|
|
47
|
+
| `exists(path)` | Check if path exists |
|
|
48
|
+
| `mkdir(path)` | Create directory recursively |
|
|
49
|
+
| `rm(path)` | Remove file or directory recursively |
|
|
50
|
+
| `rename(old, new)` | Rename or move a file |
|
|
51
|
+
| `getTempDir()` | Create an isolated temp directory |
|
|
52
|
+
| `copyDirectory(src, dest)` | Recursive directory copy |
|
|
53
|
+
|
|
54
|
+
### Namespaces
|
|
55
|
+
|
|
56
|
+
| Namespace | Description |
|
|
57
|
+
| :--- | :--- |
|
|
58
|
+
| `fs.path` | Path operations: `join`, `resolve`, `relative`, `dirname`, `basename`, `isAbsolute` |
|
|
59
|
+
| `fs.env` | Environment: `cwd()`, `homedir()`, `tmpdir()`, `getenv(key)` |
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
See the [root repository](https://github.com/UiPath/uipcli) for license information.
|