bare-fs 4.4.3 → 4.4.5

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
@@ -634,7 +634,7 @@ bare_fs__read(js_env_t *env, js_callback_info_t *info, bool async) {
634
634
  (void) err;
635
635
 
636
636
  int status;
637
- err = bare_fs__request_pending(env, req, async, NULL);
637
+ err = bare_fs__request_pending(env, req, async, &status);
638
638
  if (err != 1) return NULL;
639
639
 
640
640
  js_value_t *result;
@@ -714,7 +714,7 @@ bare_fs__readv(js_env_t *env, js_callback_info_t *info, bool async) {
714
714
  free(bufs);
715
715
 
716
716
  int status;
717
- err = bare_fs__request_pending(env, req, async, NULL);
717
+ err = bare_fs__request_pending(env, req, async, &status);
718
718
  if (err != 1) return NULL;
719
719
 
720
720
  js_value_t *result;
@@ -789,7 +789,7 @@ bare_fs__write(js_env_t *env, js_callback_info_t *info, bool async) {
789
789
  (void) err;
790
790
 
791
791
  int status;
792
- err = bare_fs__request_pending(env, req, async, NULL);
792
+ err = bare_fs__request_pending(env, req, async, &status);
793
793
  if (err != 1) return NULL;
794
794
 
795
795
  js_value_t *result;
@@ -870,7 +870,7 @@ bare_fs__writev(js_env_t *env, js_callback_info_t *info, bool async) {
870
870
  free(bufs);
871
871
 
872
872
  int status;
873
- err = bare_fs__request_pending(env, req, async, NULL);
873
+ err = bare_fs__request_pending(env, req, async, &status);
874
874
  if (err != 1) return NULL;
875
875
 
876
876
  js_value_t *result;
@@ -1976,13 +1976,7 @@ bare_fs_watcher_init(js_env_t *env, js_callback_info_t *info) {
1976
1976
  }
1977
1977
 
1978
1978
  err = uv_fs_event_start(&watcher->handle, bare_fs__on_watcher_event, (char *) path, recursive ? UV_FS_EVENT_RECURSIVE : 0);
1979
-
1980
- if (err < 0) {
1981
- err = js_throw_error(env, uv_err_name(err), uv_strerror(err));
1982
- assert(err == 0);
1983
-
1984
- return NULL;
1985
- }
1979
+ assert(err == 0);
1986
1980
 
1987
1981
  watcher->env = env;
1988
1982
  watcher->closing = false;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const FastFIFO = require('fast-fifo')
1
+ const FIFO = require('fast-fifo')
2
2
  const EventEmitter = require('bare-events')
3
3
  const path = require('bare-path')
4
4
  const { fileURLToPath } = require('bare-url')
@@ -1683,7 +1683,7 @@ class Dir {
1683
1683
 
1684
1684
  this._encoding = encoding
1685
1685
  this._capacity = bufferSize
1686
- this._buffer = new FastFIFO()
1686
+ this._buffer = new FIFO()
1687
1687
  this._ended = false
1688
1688
  this._handle = handle
1689
1689
  }
@@ -1869,7 +1869,9 @@ class Dirent {
1869
1869
 
1870
1870
  class FileReadStream extends Readable {
1871
1871
  constructor(path, opts = {}) {
1872
- super()
1872
+ const { eagerOpen = true } = opts
1873
+
1874
+ super({ eagerOpen, ...opts })
1873
1875
 
1874
1876
  this.path = path
1875
1877
  this.fd = typeof opts.fd === 'number' ? opts.fd : -1
@@ -1965,7 +1967,9 @@ class FileReadStream extends Readable {
1965
1967
 
1966
1968
  class FileWriteStream extends Writable {
1967
1969
  constructor(path, opts = {}) {
1968
- super({ map })
1970
+ const { eagerOpen = true } = opts
1971
+
1972
+ super({ eagerOpen, ...opts })
1969
1973
 
1970
1974
  this.path = path
1971
1975
  this.fd = typeof opts.fd === 'number' ? opts.fd : -1
@@ -2237,10 +2241,6 @@ exports.createWriteStream = function createWriteStream(path, opts) {
2237
2241
  return new FileWriteStream(path, opts)
2238
2242
  }
2239
2243
 
2240
- function map(data) {
2241
- return typeof data === 'string' ? Buffer.from(data) : data
2242
- }
2243
-
2244
2244
  function toNamespacedPath(filepath) {
2245
2245
  if (typeof filepath !== 'string') {
2246
2246
  if (URL.isURL(filepath)) filepath = fileURLToPath(filepath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.4.3",
3
+ "version": "4.4.5",
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