bare-fs 4.5.0 → 4.5.2

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/binding.c CHANGED
@@ -135,7 +135,8 @@ bare_fs__on_request_result(uv_fs_t *handle) {
135
135
  err = js_create_int32(env, status, &args[1]);
136
136
  assert(err == 0);
137
137
 
138
- js_call_function(env, ctx, on_result, 2, args, NULL);
138
+ err = js_call_function(env, ctx, on_result, 2, args, NULL);
139
+ (void) err;
139
140
 
140
141
  err = js_close_handle_scope(env, scope);
141
142
  assert(err == 0);
@@ -420,6 +421,21 @@ bare_fs_request_result_dirents(js_env_t *env, js_callback_info_t *info) {
420
421
 
421
422
  static void
422
423
  bare_fs__on_open(uv_fs_t *handle) {
424
+ int err;
425
+
426
+ bare_fs_req_t *req = (bare_fs_req_t *) handle;
427
+
428
+ int status = handle->result;
429
+
430
+ if (req->exiting && status >= 0) {
431
+ int fd = status;
432
+
433
+ uv_fs_req_cleanup(handle);
434
+
435
+ err = uv_fs_close(handle->loop, handle, fd, NULL);
436
+ assert(err == 0);
437
+ }
438
+
423
439
  bare_fs__on_request_result(handle);
424
440
  }
425
441
 
@@ -1656,6 +1672,21 @@ bare_fs_symlink_sync(js_env_t *env, js_callback_info_t *info) {
1656
1672
 
1657
1673
  static void
1658
1674
  bare_fs__on_opendir(uv_fs_t *handle) {
1675
+ int err;
1676
+
1677
+ bare_fs_req_t *req = (bare_fs_req_t *) handle;
1678
+
1679
+ int status = handle->result;
1680
+
1681
+ if (req->exiting && status >= 0) {
1682
+ uv_dir_t *dir = handle->ptr;
1683
+
1684
+ uv_fs_req_cleanup(handle);
1685
+
1686
+ err = uv_fs_closedir(handle->loop, handle, dir, NULL);
1687
+ assert(err == 0);
1688
+ }
1689
+
1659
1690
  bare_fs__on_request_result(handle);
1660
1691
  }
1661
1692
 
@@ -1868,7 +1899,8 @@ bare_fs__on_watcher_event(uv_fs_event_t *handle, const char *filename, int event
1868
1899
  memcpy(data, (void *) filename, len);
1869
1900
  }
1870
1901
 
1871
- js_call_function(env, ctx, on_event, 3, args, NULL);
1902
+ err = js_call_function(env, ctx, on_event, 3, args, NULL);
1903
+ (void) err;
1872
1904
 
1873
1905
  err = js_close_handle_scope(env, scope);
1874
1906
  assert(err == 0);
@@ -1915,7 +1947,8 @@ bare_fs__on_watcher_close(uv_handle_t *handle) {
1915
1947
  err = js_delete_reference(env, watcher->ctx);
1916
1948
  assert(err == 0);
1917
1949
 
1918
- js_call_function(env, ctx, on_close, 0, NULL, NULL);
1950
+ err = js_call_function(env, ctx, on_close, 0, NULL, NULL);
1951
+ (void) err;
1919
1952
 
1920
1953
  err = js_close_handle_scope(env, scope);
1921
1954
  assert(err == 0);
package/index.d.ts CHANGED
@@ -38,8 +38,7 @@ interface Callback<A extends unknown[] = []> {
38
38
  }
39
39
 
40
40
  export interface Dir<T extends string | Buffer = string | Buffer>
41
- extends Iterable<Dirent>,
42
- AsyncIterable<Dirent> {
41
+ extends Iterable<Dirent>, AsyncIterable<Dirent> {
43
42
  readonly path: string
44
43
 
45
44
  read(): Promise<Dirent<T> | null>
@@ -172,7 +171,8 @@ export interface WatcherEvents<T extends string | Buffer = string | Buffer> exte
172
171
  }
173
172
 
174
173
  export interface Watcher<T extends string | Buffer = string | Buffer>
175
- extends EventEmitter<WatcherEvents<T>>,
174
+ extends
175
+ EventEmitter<WatcherEvents<T>>,
176
176
  AsyncIterable<{ eventType: WatcherEventType; filename: T }> {
177
177
  close(): void
178
178
  ref(): void
package/index.js CHANGED
@@ -1866,8 +1866,8 @@ class Dir {
1866
1866
  }
1867
1867
 
1868
1868
  class Dirent {
1869
- constructor(path, name, type) {
1870
- this.path = path
1869
+ constructor(parentPath, name, type) {
1870
+ this.parentPath = parentPath
1871
1871
  this.name = name
1872
1872
  this.type = type
1873
1873
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
4
4
  "description": "Native file system operations for Javascript",
5
5
  "exports": {
6
6
  "./package": "./package.json",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file