bare-fs 1.6.6 → 1.6.8
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 +3 -6
- package/index.js +13 -18
- package/package.json +2 -2
package/binding.c
CHANGED
|
@@ -73,17 +73,14 @@ on_fs_response (uv_fs_t *uv_req) {
|
|
|
73
73
|
|
|
74
74
|
err = js_create_error(env, code, message, &argv[1]);
|
|
75
75
|
assert(err == 0);
|
|
76
|
-
|
|
77
|
-
err = js_get_null(env, &argv[2]);
|
|
78
|
-
assert(err == 0);
|
|
79
76
|
} else {
|
|
80
77
|
err = js_get_null(env, &argv[1]);
|
|
81
78
|
assert(err == 0);
|
|
82
|
-
|
|
83
|
-
err = js_create_int32(env, uv_req->result, &argv[2]);
|
|
84
|
-
assert(err == 0);
|
|
85
79
|
}
|
|
86
80
|
|
|
81
|
+
err = js_create_int32(env, uv_req->result, &argv[2]);
|
|
82
|
+
assert(err == 0);
|
|
83
|
+
|
|
87
84
|
uv_fs_req_cleanup(uv_req);
|
|
88
85
|
|
|
89
86
|
if (req->data) {
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { Readable, Writable } = require('streamx')
|
|
1
|
+
const { Readable, Writable, getStreamError } = require('streamx')
|
|
2
2
|
const binding = require('./binding')
|
|
3
3
|
|
|
4
4
|
const sep = process.platform === 'win32' ? '\\' : '/'
|
|
@@ -225,7 +225,7 @@ function read (fd, buffer, offset, len, pos, cb) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
if (typeof
|
|
228
|
+
if (typeof pos !== 'number') pos = -1
|
|
229
229
|
|
|
230
230
|
const req = getReq()
|
|
231
231
|
req.callback = cb
|
|
@@ -264,7 +264,7 @@ function readv (fd, buffers, pos, cb) {
|
|
|
264
264
|
throw typeError('ERR_INVALID_ARG_TYPE', 'Callback must be a function. Received type ' + (typeof cb) + ' (' + cb + ')')
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
if (typeof
|
|
267
|
+
if (typeof pos !== 'number') pos = -1
|
|
268
268
|
|
|
269
269
|
const req = getReq()
|
|
270
270
|
req.callback = cb
|
|
@@ -302,7 +302,7 @@ function write (fd, buffer, offset, len, pos, cb) {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
if (typeof
|
|
305
|
+
if (typeof pos !== 'number') pos = -1
|
|
306
306
|
|
|
307
307
|
const req = getReq()
|
|
308
308
|
req.callback = cb
|
|
@@ -341,7 +341,7 @@ function writev (fd, buffers, pos, cb) {
|
|
|
341
341
|
throw typeError('ERR_INVALID_ARG_TYPE', 'Callback must be a function. Received type ' + (typeof cb) + ' (' + cb + ')')
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
if (typeof
|
|
344
|
+
if (typeof pos !== 'number') pos = -1
|
|
345
345
|
|
|
346
346
|
const req = getReq()
|
|
347
347
|
req.callback = cb
|
|
@@ -981,7 +981,6 @@ class Dir extends Readable {
|
|
|
981
981
|
this._handle = handle
|
|
982
982
|
this._dirents = Buffer.allocUnsafe(binding.sizeofFSDirent * bufferSize)
|
|
983
983
|
this._encoding = encoding
|
|
984
|
-
this._closed = false
|
|
985
984
|
|
|
986
985
|
this.path = path
|
|
987
986
|
}
|
|
@@ -1009,25 +1008,21 @@ class Dir extends Readable {
|
|
|
1009
1008
|
}
|
|
1010
1009
|
|
|
1011
1010
|
_destroy (cb) {
|
|
1012
|
-
if (this._closed) cb(null)
|
|
1013
|
-
else this.close(cb)
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
close (cb = noop) {
|
|
1017
|
-
if (this._closed) return
|
|
1018
|
-
|
|
1019
|
-
const self = this
|
|
1020
|
-
|
|
1021
1011
|
const req = getReq()
|
|
1022
1012
|
|
|
1023
1013
|
req.callback = function (err, _) {
|
|
1024
|
-
|
|
1025
|
-
self._closed = true
|
|
1026
|
-
cb(null)
|
|
1014
|
+
cb(err)
|
|
1027
1015
|
}
|
|
1028
1016
|
|
|
1029
1017
|
binding.closedir(req.handle, this._handle)
|
|
1030
1018
|
}
|
|
1019
|
+
|
|
1020
|
+
close (cb = noop) {
|
|
1021
|
+
if (this.destroyed) return cb(null)
|
|
1022
|
+
this
|
|
1023
|
+
.once('close', () => cb(getStreamError(this)))
|
|
1024
|
+
.destroy()
|
|
1025
|
+
}
|
|
1031
1026
|
}
|
|
1032
1027
|
|
|
1033
1028
|
class Dirent {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-fs",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"description": "Native file system for Javascript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"prebuilds"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"test": "standard && bare test
|
|
15
|
+
"test": "standard && bare test.js",
|
|
16
16
|
"install": "bare-dev rebuild",
|
|
17
17
|
"prebuild": "bare-dev prebuild"
|
|
18
18
|
},
|