File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,3 +26,25 @@ extension type Process._(JSObject _) implements JSObject {
2626/// Access to the node process object
2727@JS ()
2828external Process get process;
29+
30+ /// Access to Node components
31+ abstract final class Node {
32+ /// Access to file system methods
33+ static NodeFs get fs => require ('node:fs' ) as NodeFs ;
34+ }
35+
36+ /// Node file system access
37+ extension type NodeFs ._(JSObject _) implements JSObject {
38+ /// `path` string | Buffer | URL | integer filename or file descriptor
39+ /// `options` Object | string
40+ /// `encoding` string | null Default: null
41+ /// `flag` string See support of file system flags. Default: 'r'.
42+ /// Returns: string | Buffer
43+ ///
44+ /// Returns the contents of the path.
45+ ///
46+ /// If the encoding option is specified then this function returns a string. Otherwise it returns a buffer.
47+ ///
48+ /// Ex to read a file as a string: `fs.readFileSync('/Users/joe/test.txt', 'utf8');`
49+ external JSAny readFileSync (JSAny path, JSAny options);
50+ }
You can’t perform that action at this time.
0 commit comments