bare-fs 4.4.4 → 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 +1 -7
- package/index.js +8 -8
- package/package.json +1 -1
package/binding.c
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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)
|