Skip to content

Commit bafb169

Browse files
authored
Add support for native realpath methods (#115)
1 parent 678a208 commit bafb169

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

node_interop/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.0
2+
3+
- Add support for `fs.realpath.native()` and `fs.realpathSync.native()`.
4+
15
## 2.1.1
26

37
- Correctly mark the type of the `undefined` getter as `Null`.

node_interop/lib/fs.dart

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,8 @@ abstract class FS {
9090
void Function(dynamic error, dynamic linkString) callback]);
9191
external dynamic readlinkSync(path, [options]);
9292
external int readSync(int fd, buffer, int offset, int length, int position);
93-
external void realpath(path,
94-
[optionsOrCallback,
95-
void Function(dynamic error, dynamic resolvedPath) callback]);
96-
// TODO: realpath.native(path[, options], callback)
97-
external String realpathSync(path, [options]);
98-
// TODO: realpathSync.native(path[, options])
93+
external Realpath get realpath;
94+
external RealpathSync get realpathSync;
9995
external void rename(oldPath, newPath, void Function(dynamic error) callback);
10096
external void renameSync(oldPath, newPath);
10197
external void rmdir(path, optionsOrCallback,
@@ -190,6 +186,24 @@ abstract class FSConstants {
190186
external int get S_IXOTH;
191187
}
192188

189+
@JS()
190+
@anonymous
191+
abstract class Realpath {
192+
external void call(path,
193+
[optionsOrCallback,
194+
void Function(dynamic error, dynamic resolvedPath) callback]);
195+
external void native(path,
196+
[optionsOrCallback,
197+
void Function(dynamic error, dynamic resolvedPath) callback]);
198+
}
199+
200+
@JS()
201+
@anonymous
202+
abstract class RealpathSync {
203+
external String call(path, [options]);
204+
external String native(path, [options]);
205+
}
206+
193207
@JS()
194208
@anonymous
195209
abstract class FSWatcher implements EventEmitter {

node_interop/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: node_interop
22
description: Provides Dart bindings and utility functions for core Node.js modules.
3-
version: 2.1.1
3+
version: 2.2.0
44
homepage: https://github.com/pulyaevskiy/node-interop
55
author: Anatoly Pulyaevskiy <[email protected]>
66

0 commit comments

Comments
 (0)