@lingxia/rong 0.0.1 → 0.3.0

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.
Files changed (66) hide show
  1. package/README.md +9 -7
  2. package/dist/command.d.ts +93 -0
  3. package/dist/command.d.ts.map +1 -0
  4. package/dist/command.js +6 -0
  5. package/dist/compression.d.ts +12 -0
  6. package/dist/compression.d.ts.map +1 -0
  7. package/dist/compression.js +6 -0
  8. package/dist/console.d.ts +20 -7
  9. package/dist/console.d.ts.map +1 -1
  10. package/dist/error.d.ts +40 -13
  11. package/dist/error.d.ts.map +1 -1
  12. package/dist/error.js +63 -28
  13. package/dist/fs.d.ts +111 -310
  14. package/dist/fs.d.ts.map +1 -1
  15. package/dist/fs.js +7 -4
  16. package/dist/global.d.ts +44 -37
  17. package/dist/global.d.ts.map +1 -1
  18. package/dist/http.d.ts +10 -0
  19. package/dist/http.d.ts.map +1 -1
  20. package/dist/index.d.ts +15 -12
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +15 -12
  23. package/dist/redis.d.ts +109 -0
  24. package/dist/redis.d.ts.map +1 -0
  25. package/dist/redis.js +13 -0
  26. package/dist/s3.d.ts +174 -0
  27. package/dist/s3.d.ts.map +1 -0
  28. package/dist/s3.js +10 -0
  29. package/dist/sqlite.d.ts +98 -0
  30. package/dist/sqlite.d.ts.map +1 -0
  31. package/dist/sqlite.js +8 -0
  32. package/dist/sse.d.ts +26 -0
  33. package/dist/sse.d.ts.map +1 -0
  34. package/dist/sse.js +2 -0
  35. package/dist/storage.d.ts +5 -16
  36. package/dist/storage.d.ts.map +1 -1
  37. package/dist/storage.js +4 -1
  38. package/dist/stream.d.ts +5 -8
  39. package/dist/stream.d.ts.map +1 -1
  40. package/dist/stream.js +5 -8
  41. package/dist/timer.d.ts +1 -18
  42. package/dist/timer.d.ts.map +1 -1
  43. package/dist/worker.d.ts +31 -0
  44. package/dist/worker.d.ts.map +1 -0
  45. package/dist/worker.js +14 -0
  46. package/package.json +12 -4
  47. package/src/abort.ts +0 -50
  48. package/src/assert.ts +0 -51
  49. package/src/buffer.ts +0 -60
  50. package/src/child_process.ts +0 -116
  51. package/src/console.ts +0 -53
  52. package/src/encoding.ts +0 -10
  53. package/src/error.ts +0 -149
  54. package/src/event.ts +0 -128
  55. package/src/exception.ts +0 -77
  56. package/src/fs.ts +0 -514
  57. package/src/global.ts +0 -98
  58. package/src/http.ts +0 -151
  59. package/src/index.ts +0 -67
  60. package/src/navigator.ts +0 -20
  61. package/src/path.ts +0 -83
  62. package/src/process.ts +0 -74
  63. package/src/storage.ts +0 -64
  64. package/src/stream.ts +0 -98
  65. package/src/timer.ts +0 -61
  66. package/src/url.ts +0 -106
package/dist/fs.d.ts CHANGED
@@ -2,108 +2,28 @@
2
2
  * File System module type definitions
3
3
  * Corresponds to: modules/rong_fs
4
4
  *
5
- * Provides APIs for file system operations including reading, writing, and directory management.
6
- * All file system APIs are mounted under the global `Rong` namespace.
7
- */
8
- /**
9
- * Options for reading files.
5
+ * Core API:
6
+ * Rong.file(path) RongFile (lazy file reference)
7
+ * Rong.write(dest, data) → Promise<number> (universal write)
8
+ *
9
+ * All directory/path/permission APIs remain under the global `Rong` namespace.
10
10
  */
11
- export interface ReadFileOptions {
12
- /**
13
- * AbortSignal to cancel the read operation.
14
- * When aborted, the operation will throw an AbortError.
15
- *
16
- * @see {@link AbortSignal}
17
- * @example
18
- * ```typescript
19
- * const controller = new AbortController();
20
- * const promise = Rong.readTextFile('/file.txt', {
21
- * signal: controller.signal
22
- * });
23
- * // Cancel after 1 second
24
- * setTimeout(() => controller.abort(), 1000);
25
- * ```
26
- */
27
- signal?: AbortSignal;
28
- }
29
11
  /**
30
- * Options for writing files.
31
- */
32
- export interface WriteFileOptions {
33
- /**
34
- * Append to file instead of overwriting.
35
- * Cannot be used together with `createNew`.
36
- *
37
- * @default false
38
- */
39
- append?: boolean;
40
- /**
41
- * Create file only if it doesn't exist.
42
- * Throws AlreadyExistsError if the file already exists.
43
- * Cannot be used together with `append`.
44
- *
45
- * @default false
46
- * @throws {AlreadyExistsError} If file already exists
47
- */
48
- createNew?: boolean;
49
- /**
50
- * File permissions mode (Unix-like systems only).
51
- * Octal number (e.g., 0o644 for rw-r--r--).
52
- * Ignored on Windows.
53
- *
54
- * @default 0o666 (modified by process umask)
55
- * @platform unix
56
- * @example
57
- * ```typescript
58
- * await Rong.writeTextFile('/script.sh', '#!/bin/bash\necho hello', {
59
- * mode: 0o755 // rwxr-xr-x
60
- * });
61
- * ```
62
- */
63
- mode?: number;
64
- /**
65
- * AbortSignal to cancel the write operation.
66
- *
67
- * @see {@link AbortSignal}
68
- */
69
- signal?: AbortSignal;
70
- }
71
- /**
72
- * Options for opening files.
12
+ * Options for opening files via {@link RongFile.open}.
73
13
  */
74
14
  export interface FileOpenOptions {
75
- /**
76
- * Open file for reading.
77
- * @default false
78
- */
15
+ /** Open file for reading. @default true */
79
16
  read?: boolean;
80
- /**
81
- * Open file for writing.
82
- * @default false
83
- */
17
+ /** Open file for writing. @default false */
84
18
  write?: boolean;
85
- /**
86
- * Open file for appending (writes go to end of file).
87
- * @default false
88
- */
19
+ /** Open file for appending (writes go to end of file). @default false */
89
20
  append?: boolean;
90
- /**
91
- * Truncate file to 0 bytes when opening (if it exists).
92
- * Only valid when `write` is true.
93
- * @default false
94
- */
21
+ /** Truncate file to 0 bytes when opening. Only valid when `write` is true. @default false */
95
22
  truncate?: boolean;
96
- /**
97
- * Create file if it doesn't exist.
98
- * Only valid when `write` is true.
99
- * @default false
100
- */
23
+ /** Create file if it doesn't exist. Only valid when `write` is true. @default false */
101
24
  create?: boolean;
102
25
  /**
103
26
  * Create file only if it doesn't exist (exclusive creation).
104
- * Throws AlreadyExistsError if file exists.
105
- * Only valid when `write` is true.
106
- *
107
27
  * @default false
108
28
  * @throws {AlreadyExistsError} If file already exists
109
29
  */
@@ -121,15 +41,8 @@ export interface FileOpenOptions {
121
41
  export interface MkdirOptions {
122
42
  /**
123
43
  * Create parent directories as needed.
124
- * If false and parent doesn't exist, throws NotFoundError.
125
- *
126
44
  * @default false
127
45
  * @throws {NotFoundError} If parent doesn't exist and recursive is false
128
- * @example
129
- * ```typescript
130
- * // Create nested directories
131
- * await Rong.mkdir('/path/to/nested/dir', { recursive: true });
132
- * ```
133
46
  */
134
47
  recursive?: boolean;
135
48
  /**
@@ -145,14 +58,7 @@ export interface MkdirOptions {
145
58
  export interface RemoveOptions {
146
59
  /**
147
60
  * Remove directories and their contents recursively.
148
- * If false and path is a non-empty directory, throws an error.
149
- *
150
61
  * @default false
151
- * @example
152
- * ```typescript
153
- * // Remove directory and all its contents
154
- * await Rong.remove('/path/to/dir', { recursive: true });
155
- * ```
156
62
  */
157
63
  recursive?: boolean;
158
64
  }
@@ -160,87 +66,59 @@ export interface RemoveOptions {
160
66
  * Options for setting file timestamps via {@link FsModule.utime}.
161
67
  */
162
68
  export interface UTimeOptions {
69
+ /** Access time in milliseconds since Unix epoch. */
70
+ accessed?: number;
71
+ /** Modified time in milliseconds since Unix epoch. */
72
+ modified?: number;
73
+ }
74
+ /**
75
+ * Options for creating a FileSink writer via {@link RongFile.writer}.
76
+ */
77
+ export interface FileSinkOptions {
163
78
  /**
164
- * Access time in milliseconds since Unix epoch.
165
- * If omitted, defaults to "now" (runtime-dependent).
79
+ * If true, open file in append mode. Default is truncate (overwrite).
80
+ * @default false
166
81
  */
167
- accessed?: number;
82
+ append?: boolean;
168
83
  /**
169
- * Modified time in milliseconds since Unix epoch.
170
- * If omitted, defaults to "now" (runtime-dependent).
84
+ * File permissions mode (Unix-like systems only).
85
+ * @platform unix
171
86
  */
172
- modified?: number;
87
+ mode?: number;
173
88
  }
174
89
  /**
175
90
  * File or directory metadata information.
176
- * Returned by `stat()` and `lstat()` functions.
91
+ * Returned by `RongFile.stat()` and `RongFile.lstat()`.
177
92
  */
178
93
  export interface FileInfo {
179
- /**
180
- * Whether this is a regular file.
181
- * Mutually exclusive with `isDirectory` and `isSymlink`.
182
- */
183
94
  readonly isFile: boolean;
184
- /**
185
- * Whether this is a directory.
186
- * Mutually exclusive with `isFile` and `isSymlink`.
187
- */
188
95
  readonly isDirectory: boolean;
189
- /**
190
- * Whether this is a symbolic link.
191
- * For symbolic links, use `lstat()` instead of `stat()`
192
- * to get link information rather than target information.
193
- */
194
96
  readonly isSymlink: boolean;
195
- /**
196
- * File size in bytes.
197
- * For directories, this is the size of the directory entry, not its contents.
198
- */
97
+ /** File size in bytes. */
199
98
  readonly size: number;
200
- /**
201
- * Last modified time in milliseconds since Unix epoch.
202
- * May be undefined if not supported by the file system.
203
- */
99
+ /** Last modified time in milliseconds since Unix epoch. */
204
100
  readonly modified?: number;
205
- /**
206
- * Last accessed time in milliseconds since Unix epoch.
207
- * May be undefined if not supported by the file system.
208
- */
101
+ /** Last accessed time in milliseconds since Unix epoch. */
209
102
  readonly accessed?: number;
210
- /**
211
- * Creation time in milliseconds since Unix epoch.
212
- * May be undefined if not supported by the file system.
213
- */
103
+ /** Creation time in milliseconds since Unix epoch. */
214
104
  readonly created?: number;
215
- /**
216
- * File permissions mode (Unix-like systems only).
217
- * Octal representation of file permissions.
218
- * Undefined on Windows.
219
- *
220
- * @platform unix
221
- */
105
+ /** File permissions mode (Unix only). @platform unix */
222
106
  readonly mode?: number;
223
107
  }
224
108
  /**
225
109
  * Directory entry information.
226
- * Returned by `readDir()` function.
110
+ * Returned by `Rong.readDir()`.
227
111
  */
228
112
  export interface DirEntry {
229
- /**
230
- * Entry name (without directory path).
231
- * @example For `/path/to/file.txt`, name is `file.txt`
232
- */
113
+ /** Entry name (without directory path). */
233
114
  readonly name: string;
234
- /** Whether this entry is a regular file */
235
115
  readonly isFile: boolean;
236
- /** Whether this entry is a directory */
237
116
  readonly isDirectory: boolean;
238
- /** Whether this entry is a symbolic link */
239
117
  readonly isSymlink: boolean;
240
118
  }
241
119
  /**
242
120
  * Seek modes for file positioning.
243
- * Used with `FsFile.seek()` method.
121
+ * Used with `FileHandle.seek()` method.
244
122
  */
245
123
  export declare enum SeekMode {
246
124
  /** Seek from start of file (absolute position) */
@@ -251,195 +129,118 @@ export declare enum SeekMode {
251
129
  End = 2
252
130
  }
253
131
  /**
254
- * File handle for advanced file operations.
255
- * Obtained from `Rong.open()`.
132
+ * Incremental file writer with optional append support.
133
+ * Obtained from `RongFile.writer()`.
256
134
  *
257
135
  * @example
258
136
  * ```typescript
259
- * const file = await Rong.open('/path/to/file.txt', {
137
+ * const w = await Rong.file('/log.txt').writer({ append: true });
138
+ * await w.write("line 1\n");
139
+ * await w.write("line 2\n");
140
+ * await w.flush();
141
+ * await w.end();
142
+ * ```
143
+ */
144
+ export interface FileSink {
145
+ /** Write data. Accepts string, TypedArray, or ArrayBuffer. Returns bytes written. */
146
+ write(data: string | ArrayBufferView | ArrayBuffer): Promise<number>;
147
+ /** Flush buffered data to disk. */
148
+ flush(): Promise<void>;
149
+ /** Flush and close the writer. */
150
+ end(): Promise<void>;
151
+ }
152
+ /**
153
+ * File handle for low-level file operations.
154
+ * Obtained from `RongFile.open()`.
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * const handle = await Rong.file('/path/to/file.txt').open({
260
159
  * read: true,
261
160
  * write: true
262
161
  * });
263
162
  *
264
163
  * try {
265
164
  * const buffer = new ArrayBuffer(1024);
266
- * const bytesRead = await file.read(buffer);
165
+ * const bytesRead = await handle.read(buffer);
267
166
  * console.log(`Read ${bytesRead} bytes`);
268
167
  * } finally {
269
- * await file.close();
168
+ * await handle.close();
270
169
  * }
271
170
  * ```
272
171
  */
273
- export interface FsFile {
274
- /**
275
- * Get file metadata.
276
- *
277
- * @returns Promise with file information
278
- * @throws {IOError} If stat operation fails
279
- * @example
280
- * ```typescript
281
- * const info = await file.stat();
282
- * console.log(`File size: ${info.size} bytes`);
283
- * ```
284
- */
172
+ export interface FileHandle {
285
173
  stat(): Promise<FileInfo>;
286
- /**
287
- * Read from file into buffer.
288
- * Reads from current file position and advances the position.
289
- *
290
- * @param buffer - ArrayBuffer to read into
291
- * @returns Promise with bytes read, or null on EOF
292
- * @throws {IOError} If read operation fails
293
- * @example
294
- * ```typescript
295
- * const buffer = new ArrayBuffer(4096);
296
- * const bytesRead = await file.read(buffer);
297
- * if (bytesRead === null) {
298
- * console.log('Reached end of file');
299
- * } else {
300
- * console.log(`Read ${bytesRead} bytes`);
301
- * }
302
- * ```
303
- */
304
174
  read(buffer: ArrayBuffer): Promise<number | null>;
305
- /**
306
- * Write buffer to file.
307
- * Writes at current file position and advances the position.
308
- *
309
- * @param buffer - ArrayBuffer to write
310
- * @returns Promise with number of bytes written
311
- * @throws {IOError} If write operation fails
312
- * @example
313
- * ```typescript
314
- * const data = new TextEncoder().encode('Hello World');
315
- * const bytesWritten = await file.write(data.buffer);
316
- * console.log(`Wrote ${bytesWritten} bytes`);
317
- * ```
318
- */
319
175
  write(buffer: ArrayBuffer): Promise<number>;
320
- /**
321
- * Sync file contents to disk.
322
- * Ensures all buffered writes are flushed to storage.
323
- *
324
- * @returns Promise that resolves when sync is complete
325
- * @throws {IOError} If sync operation fails
326
- */
327
176
  sync(): Promise<void>;
328
- /**
329
- * Truncate or extend file to specified length.
330
- *
331
- * @param len - Target length in bytes (default: 0)
332
- * @returns Promise that resolves when truncate is complete
333
- * @throws {IOError} If truncate operation fails
334
- * @example
335
- * ```typescript
336
- * // Truncate to 100 bytes
337
- * await file.truncate(100);
338
- *
339
- * // Truncate to 0 bytes (clear file)
340
- * await file.truncate();
341
- * ```
342
- */
343
177
  truncate(len?: number): Promise<void>;
344
- /**
345
- * Seek to position in file.
346
- *
347
- * @param offset - Byte offset
348
- * @param whence - Seek mode (Start, Current, or End)
349
- * @returns Promise with new absolute position
350
- * @throws {IOError} If seek operation fails
351
- * @example
352
- * ```typescript
353
- * // Seek to byte 100 from start
354
- * await file.seek(100, Rong.SeekMode.Start);
355
- *
356
- * // Seek forward 50 bytes from current position
357
- * await file.seek(50, Rong.SeekMode.Current);
358
- *
359
- * // Seek to 10 bytes before end
360
- * await file.seek(-10, Rong.SeekMode.End);
361
- * ```
362
- */
363
178
  seek(offset: number, whence?: SeekMode): Promise<number>;
364
- /**
365
- * Close file handle.
366
- * After closing, no further operations can be performed.
367
- * It's recommended to use try-finally to ensure files are closed.
368
- *
369
- * @returns Promise that resolves when file is closed
370
- * @example
371
- * ```typescript
372
- * const file = await Rong.open('/file.txt', { read: true });
373
- * try {
374
- * // Use file...
375
- * } finally {
376
- * await file.close();
377
- * }
378
- * ```
379
- */
380
179
  close(): Promise<void>;
381
- /**
382
- * Get ReadableStream for reading file contents.
383
- * The stream reads from the current file position.
384
- * Cannot be used simultaneously with direct read operations.
385
- *
386
- * @example
387
- * ```typescript
388
- * const file = await Rong.open('/file.txt', { read: true });
389
- * const readable = file.readable;
390
- *
391
- * for await (const chunk of readable) {
392
- * console.log('Received chunk:', chunk.length, 'bytes');
393
- * }
394
- * ```
395
- */
396
180
  readonly readable: ReadableStream<Uint8Array>;
397
- /**
398
- * Get WritableStream for writing file contents.
399
- * The stream writes to the current file position.
400
- * Cannot be used simultaneously with direct write operations.
401
- *
402
- * @example
403
- * ```typescript
404
- * const file = await Rong.open('/file.txt', { write: true, create: true });
405
- * const writable = file.writable;
406
- * const writer = writable.getWriter();
407
- *
408
- * await writer.write(new TextEncoder().encode('Hello'));
409
- * await writer.close();
410
- * ```
411
- */
412
181
  readonly writable: WritableStream<Uint8Array>;
413
182
  }
183
+ /**
184
+ * Lazy file reference. Created by `Rong.file(path)`.
185
+ * Does NOT touch the filesystem until a method is called.
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const f = Rong.file('/data.json');
190
+ *
191
+ * // Convenient whole-file operations
192
+ * const text = await f.text();
193
+ * const data = await f.json();
194
+ * const exists = await f.exists();
195
+ *
196
+ * // Low-level access when needed
197
+ * const handle = await f.open({ read: true, write: true });
198
+ * await handle.seek(100, Rong.SeekMode.Start);
199
+ * await handle.close();
200
+ * ```
201
+ */
202
+ export interface RongFile {
203
+ /** The original path passed to `Rong.file()`. */
204
+ readonly name: string;
205
+ /** Read file contents as a UTF-8 string. */
206
+ text(): Promise<string>;
207
+ /** Read file contents and parse as JSON. */
208
+ json(): Promise<any>;
209
+ /** Read file contents as Uint8Array. */
210
+ bytes(): Promise<Uint8Array>;
211
+ /** Read file contents as ArrayBuffer. */
212
+ arrayBuffer(): Promise<ArrayBuffer>;
213
+ /** Get a ReadableStream of file contents. */
214
+ stream(): ReadableStream<Uint8Array>;
215
+ /** Check if the file exists. */
216
+ exists(): Promise<boolean>;
217
+ /** Delete the file. */
218
+ delete(): Promise<void>;
219
+ /** Get file metadata. */
220
+ stat(): Promise<FileInfo>;
221
+ /** Get file metadata (does not follow symlinks). */
222
+ lstat(): Promise<FileInfo>;
223
+ /** Open a low-level file handle for seek/truncate/random-access. */
224
+ open(options?: FileOpenOptions): Promise<FileHandle>;
225
+ /** Create an incremental writer (default: truncate; use `{ append: true }` for append). */
226
+ writer(options?: FileSinkOptions): Promise<FileSink>;
227
+ }
414
228
  /**
415
229
  * File System module interface.
416
230
  * All operations are available under the global `Rong` namespace.
417
231
  */
418
232
  export interface FsModule {
419
- readTextFile(path: string, options?: ReadFileOptions): Promise<string>;
420
- readFile(path: string, options?: ReadFileOptions): Promise<ArrayBuffer>;
421
- writeTextFile(path: string, text: string, options?: WriteFileOptions): Promise<void>;
422
- writeFile(path: string, data: ArrayBufferView, options?: WriteFileOptions): Promise<void>;
423
- copyFile(from: string, to: string): Promise<void>;
424
- truncate(path: string, len?: number): Promise<void>;
425
- open(path: string, options?: FileOpenOptions): Promise<FsFile>;
233
+ file(path: string): RongFile;
234
+ write(dest: string | RongFile, data: string | ArrayBufferView | ArrayBuffer | RongFile): Promise<number>;
426
235
  mkdir(path: string, options?: MkdirOptions): Promise<void>;
427
236
  readDir(path: string): Promise<AsyncIterableIterator<DirEntry>>;
428
- stat(path: string): Promise<FileInfo>;
429
- lstat(path: string): Promise<FileInfo>;
430
237
  remove(path: string, options?: RemoveOptions): Promise<void>;
431
238
  chdir(path: string): Promise<void>;
432
239
  symlink(target: string, path: string): Promise<void>;
433
240
  readlink(path: string): Promise<string>;
434
- /**
435
- * Change file permissions (Unix only)
436
- * @platform unix
437
- */
241
+ /** Change file permissions (Unix only) @platform unix */
438
242
  chmod(path: string, mode: number): Promise<void>;
439
- /**
440
- * Change file ownership (Unix only)
441
- * @platform unix
442
- */
243
+ /** Change file ownership (Unix only) @platform unix */
443
244
  chown(path: string, uid: number, gid: number): Promise<void>;
444
245
  utime(path: string, options: UTimeOptions): Promise<void>;
445
246
  rename(oldPath: string, newPath: string): Promise<void>;
package/dist/fs.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC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AAC;IAC7D,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGnC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAGxC,yDAAyD;IACzD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,uDAAuD;IACvD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG1D,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAGxC,QAAQ,CAAC,QAAQ,EAAE,OAAO,QAAQ,CAAC;CACpC;AAED,OAAO,EAAE,CAAC"}
package/dist/fs.js CHANGED
@@ -3,14 +3,17 @@
3
3
  * File System module type definitions
4
4
  * Corresponds to: modules/rong_fs
5
5
  *
6
- * Provides APIs for file system operations including reading, writing, and directory management.
7
- * All file system APIs are mounted under the global `Rong` namespace.
6
+ * Core API:
7
+ * Rong.file(path) RongFile (lazy file reference)
8
+ * Rong.write(dest, data) → Promise<number> (universal write)
9
+ *
10
+ * All directory/path/permission APIs remain under the global `Rong` namespace.
8
11
  */
9
12
  Object.defineProperty(exports, "__esModule", { value: true });
10
13
  exports.SeekMode = void 0;
11
14
  /**
12
15
  * Seek modes for file positioning.
13
- * Used with `FsFile.seek()` method.
16
+ * Used with `FileHandle.seek()` method.
14
17
  */
15
18
  var SeekMode;
16
19
  (function (SeekMode) {
@@ -20,4 +23,4 @@ var SeekMode;
20
23
  SeekMode[SeekMode["Current"] = 1] = "Current";
21
24
  /** Seek from end of file (usually negative offset) */
22
25
  SeekMode[SeekMode["End"] = 2] = "End";
23
- })(SeekMode = exports.SeekMode || (exports.SeekMode = {}));
26
+ })(SeekMode || (exports.SeekMode = SeekMode = {}));