@elaraai/east-node-std 0.0.1-beta.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 (101) hide show
  1. package/CLA.md +26 -0
  2. package/CONTRIBUTING.md +28 -0
  3. package/README.md +135 -0
  4. package/dist/console.d.ts +192 -0
  5. package/dist/console.d.ts.map +1 -0
  6. package/dist/console.js +228 -0
  7. package/dist/console.js.map +1 -0
  8. package/dist/crypto.d.ts +212 -0
  9. package/dist/crypto.d.ts.map +1 -0
  10. package/dist/crypto.js +259 -0
  11. package/dist/crypto.js.map +1 -0
  12. package/dist/fetch.d.ts +310 -0
  13. package/dist/fetch.d.ts.map +1 -0
  14. package/dist/fetch.js +336 -0
  15. package/dist/fetch.js.map +1 -0
  16. package/dist/fs.d.ts +520 -0
  17. package/dist/fs.d.ts.map +1 -0
  18. package/dist/fs.js +630 -0
  19. package/dist/fs.js.map +1 -0
  20. package/dist/index.d.ts +59 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +86 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/path.d.ts +241 -0
  25. package/dist/path.d.ts.map +1 -0
  26. package/dist/path.js +299 -0
  27. package/dist/path.js.map +1 -0
  28. package/dist/random/crypto-rng.d.ts +31 -0
  29. package/dist/random/crypto-rng.d.ts.map +1 -0
  30. package/dist/random/crypto-rng.js +44 -0
  31. package/dist/random/crypto-rng.js.map +1 -0
  32. package/dist/random/distributions/bates.d.ts +12 -0
  33. package/dist/random/distributions/bates.d.ts.map +1 -0
  34. package/dist/random/distributions/bates.js +15 -0
  35. package/dist/random/distributions/bates.js.map +1 -0
  36. package/dist/random/distributions/bernoulli.d.ts +12 -0
  37. package/dist/random/distributions/bernoulli.d.ts.map +1 -0
  38. package/dist/random/distributions/bernoulli.js +13 -0
  39. package/dist/random/distributions/bernoulli.js.map +1 -0
  40. package/dist/random/distributions/binomial.d.ts +12 -0
  41. package/dist/random/distributions/binomial.d.ts.map +1 -0
  42. package/dist/random/distributions/binomial.js +24 -0
  43. package/dist/random/distributions/binomial.js.map +1 -0
  44. package/dist/random/distributions/exponential.d.ts +12 -0
  45. package/dist/random/distributions/exponential.d.ts.map +1 -0
  46. package/dist/random/distributions/exponential.js +13 -0
  47. package/dist/random/distributions/exponential.js.map +1 -0
  48. package/dist/random/distributions/geometric.d.ts +12 -0
  49. package/dist/random/distributions/geometric.d.ts.map +1 -0
  50. package/dist/random/distributions/geometric.js +14 -0
  51. package/dist/random/distributions/geometric.js.map +1 -0
  52. package/dist/random/distributions/irwin-hall.d.ts +12 -0
  53. package/dist/random/distributions/irwin-hall.d.ts.map +1 -0
  54. package/dist/random/distributions/irwin-hall.js +18 -0
  55. package/dist/random/distributions/irwin-hall.js.map +1 -0
  56. package/dist/random/distributions/log-normal.d.ts +12 -0
  57. package/dist/random/distributions/log-normal.d.ts.map +1 -0
  58. package/dist/random/distributions/log-normal.js +12 -0
  59. package/dist/random/distributions/log-normal.js.map +1 -0
  60. package/dist/random/distributions/normal.d.ts +13 -0
  61. package/dist/random/distributions/normal.d.ts.map +1 -0
  62. package/dist/random/distributions/normal.js +16 -0
  63. package/dist/random/distributions/normal.js.map +1 -0
  64. package/dist/random/distributions/pareto.d.ts +12 -0
  65. package/dist/random/distributions/pareto.d.ts.map +1 -0
  66. package/dist/random/distributions/pareto.js +14 -0
  67. package/dist/random/distributions/pareto.js.map +1 -0
  68. package/dist/random/distributions/poisson.d.ts +12 -0
  69. package/dist/random/distributions/poisson.d.ts.map +1 -0
  70. package/dist/random/distributions/poisson.js +81 -0
  71. package/dist/random/distributions/poisson.js.map +1 -0
  72. package/dist/random/distributions/uniform-int.d.ts +12 -0
  73. package/dist/random/distributions/uniform-int.d.ts.map +1 -0
  74. package/dist/random/distributions/uniform-int.js +16 -0
  75. package/dist/random/distributions/uniform-int.js.map +1 -0
  76. package/dist/random/distributions/uniform.d.ts +12 -0
  77. package/dist/random/distributions/uniform.d.ts.map +1 -0
  78. package/dist/random/distributions/uniform.js +10 -0
  79. package/dist/random/distributions/uniform.js.map +1 -0
  80. package/dist/random/rng.d.ts +17 -0
  81. package/dist/random/rng.d.ts.map +1 -0
  82. package/dist/random/rng.js +7 -0
  83. package/dist/random/rng.js.map +1 -0
  84. package/dist/random/xorshift128.d.ts +35 -0
  85. package/dist/random/xorshift128.d.ts.map +1 -0
  86. package/dist/random/xorshift128.js +112 -0
  87. package/dist/random/xorshift128.js.map +1 -0
  88. package/dist/random.d.ts +773 -0
  89. package/dist/random.d.ts.map +1 -0
  90. package/dist/random.js +934 -0
  91. package/dist/random.js.map +1 -0
  92. package/dist/test.d.ts +253 -0
  93. package/dist/test.d.ts.map +1 -0
  94. package/dist/test.js +407 -0
  95. package/dist/test.js.map +1 -0
  96. package/dist/time.d.ts +130 -0
  97. package/dist/time.d.ts.map +1 -0
  98. package/dist/time.js +154 -0
  99. package/dist/time.js.map +1 -0
  100. package/dist/tsconfig.tsbuildinfo +1 -0
  101. package/package.json +84 -0
package/dist/fs.d.ts ADDED
@@ -0,0 +1,520 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { StringType, NullType, BooleanType, ArrayType, BlobType } from "@elaraai/east";
6
+ import type { PlatformFunction, PlatformFunctionDef } from "@elaraai/east/internal";
7
+ /**
8
+ * Reads a file as a UTF-8 string.
9
+ *
10
+ * Reads the entire contents of a file synchronously and decodes it as UTF-8 text.
11
+ * Paths are resolved relative to the current working directory.
12
+ *
13
+ * This is a platform function for the East language, enabling file reading
14
+ * in East programs running on Node.js.
15
+ *
16
+ * @param path - The file path to read (relative or absolute)
17
+ * @returns The file contents as a UTF-8 string
18
+ *
19
+ * @throws {EastError} When file cannot be read:
20
+ * - File doesn't exist: `ENOENT: no such file or directory`
21
+ * - No read permission: `EACCES: permission denied`
22
+ * - Path is a directory: `EISDIR: illegal operation on a directory`
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const readConfig = East.function([], StringType, $ => {
27
+ * const content = $.let(FileSystem.readFile("config.txt"));
28
+ * return content;
29
+ * });
30
+ * ```
31
+ */
32
+ export declare const fs_read_file: PlatformFunctionDef<[typeof StringType], typeof StringType>;
33
+ /**
34
+ * Writes a string to a file (overwrites existing content).
35
+ *
36
+ * Writes string content to a file synchronously, creating the file if it doesn't exist
37
+ * and overwriting it if it does. Content is encoded as UTF-8.
38
+ *
39
+ * This is a platform function for the East language, enabling file writing
40
+ * in East programs running on Node.js.
41
+ *
42
+ * @param path - The file path to write (relative or absolute)
43
+ * @param content - The string content to write (UTF-8 encoded)
44
+ * @returns Null
45
+ *
46
+ * @throws {EastError} When file cannot be written:
47
+ * - No write permission: `EACCES: permission denied`
48
+ * - Parent directory doesn't exist: `ENOENT: no such file or directory`
49
+ * - Path is a directory: `EISDIR: illegal operation on a directory`
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const saveOutput = East.function([], NullType, $ => {
54
+ * $(FileSystem.writeFile("output.txt", "Hello, World!"));
55
+ * });
56
+ * ```
57
+ */
58
+ export declare const fs_write_file: PlatformFunctionDef<[typeof StringType, typeof StringType], typeof NullType>;
59
+ /**
60
+ * Appends a string to a file.
61
+ *
62
+ * Appends string content to the end of a file synchronously, creating the file
63
+ * if it doesn't exist. Content is encoded as UTF-8.
64
+ *
65
+ * This is a platform function for the East language, enabling file appending
66
+ * in East programs running on Node.js.
67
+ *
68
+ * @param path - The file path to append to (relative or absolute)
69
+ * @param content - The string content to append (UTF-8 encoded)
70
+ * @returns Null
71
+ *
72
+ * @throws {EastError} When file cannot be appended:
73
+ * - No write permission: `EACCES: permission denied`
74
+ * - Path is a directory: `EISDIR: illegal operation on a directory`
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const appendLog = East.function([], NullType, $ => {
79
+ * $(FileSystem.appendFile("log.txt", "New log entry\n"));
80
+ * });
81
+ * ```
82
+ */
83
+ export declare const fs_append_file: PlatformFunctionDef<[typeof StringType, typeof StringType], typeof NullType>;
84
+ /**
85
+ * Deletes a file from the file system.
86
+ *
87
+ * Removes a file synchronously. If the file doesn't exist, an error is thrown.
88
+ * This operation cannot be undone.
89
+ *
90
+ * This is a platform function for the East language, enabling file deletion
91
+ * in East programs running on Node.js.
92
+ *
93
+ * @param path - The file path to delete (relative or absolute)
94
+ * @returns Null
95
+ *
96
+ * @throws {EastError} When file cannot be deleted:
97
+ * - File doesn't exist: `ENOENT: no such file or directory`
98
+ * - No delete permission: `EACCES: permission denied`
99
+ * - Path is a directory: `EISDIR: illegal operation on a directory`
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const cleanup = East.function([], NullType, $ => {
104
+ * $(FileSystem.deleteFile("temp.txt"));
105
+ * });
106
+ * ```
107
+ */
108
+ export declare const fs_delete_file: PlatformFunctionDef<[typeof StringType], typeof NullType>;
109
+ /**
110
+ * Checks if a file or directory exists at the given path.
111
+ *
112
+ * Tests whether a path exists in the file system, returning true if it exists
113
+ * (whether file or directory) and false otherwise. This check is synchronous
114
+ * and does not throw errors for permission issues.
115
+ *
116
+ * This is a platform function for the East language, enabling path existence checks
117
+ * in East programs running on Node.js.
118
+ *
119
+ * @param path - The path to check (relative or absolute)
120
+ * @returns True if the path exists, false otherwise
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const checkConfig = East.function([], BooleanType, $ => {
125
+ * return FileSystem.exists("config.txt");
126
+ * });
127
+ * ```
128
+ */
129
+ export declare const fs_exists: PlatformFunctionDef<[typeof StringType], typeof BooleanType>;
130
+ /**
131
+ * Checks if a path exists and is a regular file.
132
+ *
133
+ * Tests whether a path exists and is a regular file (not a directory, symlink, etc.).
134
+ * Returns false if the path doesn't exist or is not a file. Does not throw errors
135
+ * for permission issues.
136
+ *
137
+ * This is a platform function for the East language, enabling file type checks
138
+ * in East programs running on Node.js.
139
+ *
140
+ * @param path - The path to check (relative or absolute)
141
+ * @returns True if the path exists and is a file, false otherwise
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const checkIsFile = East.function([], BooleanType, $ => {
146
+ * return FileSystem.isFile("data.json");
147
+ * });
148
+ * ```
149
+ */
150
+ export declare const fs_is_file: PlatformFunctionDef<[typeof StringType], typeof BooleanType>;
151
+ /**
152
+ * Checks if a path exists and is a directory.
153
+ *
154
+ * Tests whether a path exists and is a directory (not a regular file).
155
+ * Returns false if the path doesn't exist or is not a directory. Does not throw
156
+ * errors for permission issues.
157
+ *
158
+ * This is a platform function for the East language, enabling directory type checks
159
+ * in East programs running on Node.js.
160
+ *
161
+ * @param path - The path to check (relative or absolute)
162
+ * @returns True if the path exists and is a directory, false otherwise
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const checkIsDir = East.function([], BooleanType, $ => {
167
+ * return FileSystem.isDirectory("src");
168
+ * });
169
+ * ```
170
+ */
171
+ export declare const fs_is_directory: PlatformFunctionDef<[typeof StringType], typeof BooleanType>;
172
+ /**
173
+ * Creates a directory, including any necessary parent directories.
174
+ *
175
+ * Creates a directory synchronously with recursive creation enabled, meaning
176
+ * all necessary parent directories will be created if they don't exist.
177
+ * If the directory already exists, no error is thrown.
178
+ *
179
+ * This is a platform function for the East language, enabling directory creation
180
+ * in East programs running on Node.js.
181
+ *
182
+ * @param path - The directory path to create (relative or absolute)
183
+ * @returns Null
184
+ *
185
+ * @throws {EastError} When directory cannot be created:
186
+ * - No write permission: `EACCES: permission denied`
187
+ * - Path exists as a file: `EEXIST: file already exists`
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * const setupDirs = East.function([], NullType, $ => {
192
+ * $(FileSystem.createDirectory("output/reports/2024"));
193
+ * });
194
+ * ```
195
+ */
196
+ export declare const fs_create_directory: PlatformFunctionDef<[typeof StringType], typeof NullType>;
197
+ /**
198
+ * Lists the names of all files and directories within a directory.
199
+ *
200
+ * Reads the contents of a directory synchronously and returns an array of entry names
201
+ * (not full paths). The entries include both files and subdirectories. Special entries
202
+ * like "." and ".." are not included. The order is not guaranteed.
203
+ *
204
+ * This is a platform function for the East language, enabling directory listing
205
+ * in East programs running on Node.js.
206
+ *
207
+ * @param path - The directory path to read (relative or absolute)
208
+ * @returns Array of file and directory names within the directory
209
+ *
210
+ * @throws {EastError} When directory cannot be read:
211
+ * - Directory doesn't exist: `ENOENT: no such file or directory`
212
+ * - No read permission: `EACCES: permission denied`
213
+ * - Path is not a directory: `ENOTDIR: not a directory`
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * const listFiles = East.function([], ArrayType(StringType), $ => {
218
+ * return FileSystem.readDirectory("src");
219
+ * // Returns: ["index.ts", "utils", "types.ts"]
220
+ * });
221
+ * ```
222
+ */
223
+ export declare const fs_read_directory: PlatformFunctionDef<[typeof StringType], ReturnType<typeof ArrayType<typeof StringType>>>;
224
+ /**
225
+ * Reads a file as binary data without any encoding.
226
+ *
227
+ * Reads the entire contents of a file synchronously as raw bytes, returning
228
+ * a Blob (Uint8Array) without any text decoding. Useful for reading non-text
229
+ * files like images, PDFs, or binary data formats.
230
+ *
231
+ * This is a platform function for the East language, enabling binary file reading
232
+ * in East programs running on Node.js.
233
+ *
234
+ * @param path - The file path to read (relative or absolute)
235
+ * @returns The file contents as a Blob (binary data)
236
+ *
237
+ * @throws {EastError} When file cannot be read:
238
+ * - File doesn't exist: `ENOENT: no such file or directory`
239
+ * - No read permission: `EACCES: permission denied`
240
+ * - Path is a directory: `EISDIR: illegal operation on a directory`
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * const loadImage = East.function([], BlobType, $ => {
245
+ * return FileSystem.readFileBytes("logo.png");
246
+ * });
247
+ * ```
248
+ */
249
+ export declare const fs_read_file_bytes: PlatformFunctionDef<[StringType], BlobType>;
250
+ /**
251
+ * Writes binary data to a file (overwrites existing content).
252
+ *
253
+ * Writes raw binary data to a file synchronously without any text encoding,
254
+ * creating the file if it doesn't exist and overwriting it if it does.
255
+ * Useful for writing non-text files like images, PDFs, or binary data formats.
256
+ *
257
+ * This is a platform function for the East language, enabling binary file writing
258
+ * in East programs running on Node.js.
259
+ *
260
+ * @param path - The file path to write (relative or absolute)
261
+ * @param content - The binary content to write (Blob/Uint8Array)
262
+ * @returns Null
263
+ *
264
+ * @throws {EastError} When file cannot be written:
265
+ * - No write permission: `EACCES: permission denied`
266
+ * - Parent directory doesn't exist: `ENOENT: no such file or directory`
267
+ * - Path is a directory: `EISDIR: illegal operation on a directory`
268
+ *
269
+ * @example
270
+ * ```ts
271
+ * const saveBinary = East.function([BlobType], NullType, ($, data) => {
272
+ * $(FileSystem.writeFileBytes("output.bin", data));
273
+ * });
274
+ * ```
275
+ */
276
+ export declare const fs_write_file_bytes: PlatformFunctionDef<[typeof StringType, typeof BlobType], typeof NullType>;
277
+ /**
278
+ * Node.js implementation of file system platform functions.
279
+ *
280
+ * Pass this array to {@link East.compile} to enable file system operations.
281
+ */
282
+ declare const FileSystemImpl: PlatformFunction[];
283
+ /**
284
+ * Grouped file system platform functions.
285
+ *
286
+ * Provides file system operations for East programs.
287
+ *
288
+ * @example
289
+ * ```ts
290
+ * import { East, NullType } from "@elaraai/east";
291
+ * import { FileSystem } from "@elaraai/east-node-std";
292
+ *
293
+ * const processFile = East.function([], NullType, $ => {
294
+ * const content = $.let(FileSystem.readFile("input.txt"));
295
+ * $(FileSystem.writeFile("output.txt", content));
296
+ * });
297
+ *
298
+ * const compiled = East.compile(processFile.toIR(), FileSystem.Implementation);
299
+ * await compiled();
300
+ * ```
301
+ */
302
+ export declare const FileSystem: {
303
+ /**
304
+ * Reads a file as a UTF-8 string.
305
+ *
306
+ * Reads the entire contents of a file synchronously and decodes it as UTF-8 text.
307
+ * Paths are resolved relative to the current working directory.
308
+ *
309
+ * @param path - The file path to read (relative or absolute)
310
+ * @returns The file contents as a UTF-8 string
311
+ * @throws {EastError} When file cannot be read (ENOENT, EACCES, EISDIR)
312
+ *
313
+ * @example
314
+ * ```ts
315
+ * const readConfig = East.function([], StringType, $ => {
316
+ * const content = $.let(FileSystem.readFile("config.txt"));
317
+ * return content;
318
+ * });
319
+ *
320
+ * const compiled = East.compile(readConfig.toIR(), FileSystem.Implementation);
321
+ * await compiled(); // Returns file content as string
322
+ * ```
323
+ */
324
+ readonly readFile: PlatformFunctionDef<[StringType], StringType>;
325
+ /**
326
+ * Writes a string to a file (overwrites existing content).
327
+ *
328
+ * Writes string content to a file synchronously, creating the file if it doesn't exist
329
+ * and overwriting it if it does. Content is encoded as UTF-8.
330
+ *
331
+ * @param path - The file path to write (relative or absolute)
332
+ * @param content - The string content to write (UTF-8 encoded)
333
+ * @returns Null
334
+ * @throws {EastError} When file cannot be written (EACCES, ENOENT, EISDIR)
335
+ *
336
+ * @example
337
+ * ```ts
338
+ * const saveOutput = East.function([], NullType, $ => {
339
+ * $(FileSystem.writeFile("output.txt", "Hello, World!"));
340
+ * });
341
+ *
342
+ * const compiled = East.compile(saveOutput.toIR(), FileSystem.Implementation);
343
+ * await compiled(); // File written successfully
344
+ * ```
345
+ */
346
+ readonly writeFile: PlatformFunctionDef<[StringType, StringType], NullType>;
347
+ /**
348
+ * Appends a string to a file.
349
+ *
350
+ * Appends string content to the end of a file synchronously, creating the file
351
+ * if it doesn't exist. Content is encoded as UTF-8.
352
+ *
353
+ * @param path - The file path to append to (relative or absolute)
354
+ * @param content - The string content to append (UTF-8 encoded)
355
+ * @returns Null
356
+ * @throws {EastError} When file cannot be appended (EACCES, EISDIR)
357
+ *
358
+ * @example
359
+ * ```ts
360
+ * const appendLog = East.function([], NullType, $ => {
361
+ * $(FileSystem.appendFile("log.txt", "New log entry\n"));
362
+ * });
363
+ * ```
364
+ */
365
+ readonly appendFile: PlatformFunctionDef<[StringType, StringType], NullType>;
366
+ /**
367
+ * Deletes a file from the file system.
368
+ *
369
+ * Removes a file synchronously. If the file doesn't exist, an error is thrown.
370
+ * This operation cannot be undone.
371
+ *
372
+ * @param path - The file path to delete (relative or absolute)
373
+ * @returns Null
374
+ * @throws {EastError} When file cannot be deleted (ENOENT, EACCES, EISDIR)
375
+ *
376
+ * @example
377
+ * ```ts
378
+ * const cleanup = East.function([], NullType, $ => {
379
+ * $(FileSystem.deleteFile("temp.txt"));
380
+ * });
381
+ * ```
382
+ */
383
+ readonly deleteFile: PlatformFunctionDef<[StringType], NullType>;
384
+ /**
385
+ * Checks if a file or directory exists at the given path.
386
+ *
387
+ * Tests whether a path exists in the file system, returning true if it exists
388
+ * (whether file or directory) and false otherwise.
389
+ *
390
+ * @param path - The path to check (relative or absolute)
391
+ * @returns True if the path exists, false otherwise
392
+ *
393
+ * @example
394
+ * ```ts
395
+ * const checkConfig = East.function([], BooleanType, $ => {
396
+ * return FileSystem.exists("config.txt");
397
+ * });
398
+ * ```
399
+ */
400
+ readonly exists: PlatformFunctionDef<[StringType], BooleanType>;
401
+ /**
402
+ * Checks if a path exists and is a regular file.
403
+ *
404
+ * Tests whether a path exists and is a regular file (not a directory, symlink, etc.).
405
+ * Returns false if the path doesn't exist or is not a file.
406
+ *
407
+ * @param path - The path to check (relative or absolute)
408
+ * @returns True if the path exists and is a file, false otherwise
409
+ *
410
+ * @example
411
+ * ```ts
412
+ * const checkIsFile = East.function([], BooleanType, $ => {
413
+ * return FileSystem.isFile("data.json");
414
+ * });
415
+ * ```
416
+ */
417
+ readonly isFile: PlatformFunctionDef<[StringType], BooleanType>;
418
+ /**
419
+ * Checks if a path exists and is a directory.
420
+ *
421
+ * Tests whether a path exists and is a directory (not a regular file).
422
+ * Returns false if the path doesn't exist or is not a directory.
423
+ *
424
+ * @param path - The path to check (relative or absolute)
425
+ * @returns True if the path exists and is a directory, false otherwise
426
+ *
427
+ * @example
428
+ * ```ts
429
+ * const checkIsDir = East.function([], BooleanType, $ => {
430
+ * return FileSystem.isDirectory("src");
431
+ * });
432
+ * ```
433
+ */
434
+ readonly isDirectory: PlatformFunctionDef<[StringType], BooleanType>;
435
+ /**
436
+ * Creates a directory, including any necessary parent directories.
437
+ *
438
+ * Creates a directory synchronously with recursive creation enabled, meaning
439
+ * all necessary parent directories will be created if they don't exist.
440
+ *
441
+ * @param path - The directory path to create (relative or absolute)
442
+ * @returns Null
443
+ * @throws {EastError} When directory cannot be created (EACCES, EEXIST)
444
+ *
445
+ * @example
446
+ * ```ts
447
+ * const setupDirs = East.function([], NullType, $ => {
448
+ * $(FileSystem.createDirectory("output/reports/2024"));
449
+ * });
450
+ * ```
451
+ */
452
+ readonly createDirectory: PlatformFunctionDef<[StringType], NullType>;
453
+ /**
454
+ * Lists the names of all files and directories within a directory.
455
+ *
456
+ * Reads the contents of a directory synchronously and returns an array of entry names
457
+ * (not full paths). The entries include both files and subdirectories.
458
+ *
459
+ * @param path - The directory path to read (relative or absolute)
460
+ * @returns Array of file and directory names within the directory
461
+ * @throws {EastError} When directory cannot be read (ENOENT, EACCES, ENOTDIR)
462
+ *
463
+ * @example
464
+ * ```ts
465
+ * const listFiles = East.function([], ArrayType(StringType), $ => {
466
+ * return FileSystem.readDirectory("src");
467
+ * });
468
+ * ```
469
+ */
470
+ readonly readDirectory: PlatformFunctionDef<[StringType], ArrayType<StringType>>;
471
+ /**
472
+ * Reads a file as binary data without any encoding.
473
+ *
474
+ * Reads the entire contents of a file synchronously as raw bytes, returning
475
+ * a Blob (Uint8Array) without any text decoding.
476
+ *
477
+ * @param path - The file path to read (relative or absolute)
478
+ * @returns The file contents as a Blob (binary data)
479
+ * @throws {EastError} When file cannot be read (ENOENT, EACCES, EISDIR)
480
+ *
481
+ * @example
482
+ * ```ts
483
+ * const loadImage = East.function([], BlobType, $ => {
484
+ * return FileSystem.readFileBytes("logo.png");
485
+ * });
486
+ * ```
487
+ */
488
+ readonly readFileBytes: PlatformFunctionDef<[StringType], BlobType>;
489
+ /**
490
+ * Writes binary data to a file (overwrites existing content).
491
+ *
492
+ * Writes raw binary data to a file synchronously without any text encoding,
493
+ * creating the file if it doesn't exist and overwriting it if it does.
494
+ *
495
+ * @param path - The file path to write (relative or absolute)
496
+ * @param content - The binary content to write (Blob/Uint8Array)
497
+ * @returns Null
498
+ * @throws {EastError} When file cannot be written (EACCES, ENOENT, EISDIR)
499
+ *
500
+ * @example
501
+ * ```ts
502
+ * const saveBinary = East.function([BlobType], NullType, ($, data) => {
503
+ * $(FileSystem.writeFileBytes("output.bin", data));
504
+ * });
505
+ *
506
+ * const compiled = East.compile(saveBinary.toIR(), FileSystem.Implementation);
507
+ * const binaryData = new Uint8Array([1, 2, 3, 4]);
508
+ * await compiled(binaryData); // Binary data written to file
509
+ * ```
510
+ */
511
+ readonly writeFileBytes: PlatformFunctionDef<[StringType, BlobType], NullType>;
512
+ /**
513
+ * Node.js implementation of file system platform functions.
514
+ *
515
+ * Pass this to {@link East.compile} to enable file system operations.
516
+ */
517
+ readonly Implementation: PlatformFunction[];
518
+ };
519
+ export { FileSystemImpl };
520
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAQ,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAapF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,YAAY,EAAE,mBAAmB,CAAC,CAAC,OAAO,UAAU,CAAC,EAAE,OAAO,UAAU,CAA2D,CAAC;AAEjJ;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,EAAE,mBAAmB,CAAC,CAAC,OAAO,UAAU,EAAE,OAAO,UAAU,CAAC,EAAE,OAAO,QAAQ,CAAsE,CAAC;AAE9K;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,EAAE,mBAAmB,CAAC,CAAC,OAAO,UAAU,EAAE,OAAO,UAAU,CAAC,EAAE,OAAO,QAAQ,CAAuE,CAAC;AAEhL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,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