bare-fs 2.3.0 → 2.3.1
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 -1
- package/index.js +13 -15
- package/package.json +2 -2
package/binding.c
CHANGED
|
@@ -2373,7 +2373,7 @@ bare_fs_exports (js_env_t *env, js_value_t *exports) {
|
|
|
2373
2373
|
js_value_t *val; \
|
|
2374
2374
|
err = js_create_function(env, name, -1, fn, NULL, &val); \
|
|
2375
2375
|
assert(err == 0); \
|
|
2376
|
-
js_set_named_property(env, exports, name, val); \
|
|
2376
|
+
err = js_set_named_property(env, exports, name, val); \
|
|
2377
2377
|
assert(err == 0); \
|
|
2378
2378
|
}
|
|
2379
2379
|
|
package/index.js
CHANGED
|
@@ -1657,13 +1657,13 @@ class FileWriteStream extends Writable {
|
|
|
1657
1657
|
})
|
|
1658
1658
|
}
|
|
1659
1659
|
|
|
1660
|
-
_writev (
|
|
1661
|
-
writev(this.fd,
|
|
1660
|
+
_writev (batch, cb) {
|
|
1661
|
+
writev(this.fd, batch.map(({ chunk }) => chunk), cb)
|
|
1662
1662
|
}
|
|
1663
1663
|
|
|
1664
|
-
_destroy (cb) {
|
|
1665
|
-
if (!this.fd) return cb(
|
|
1666
|
-
close(this.fd, () => cb(
|
|
1664
|
+
_destroy (err, cb) {
|
|
1665
|
+
if (!this.fd) return cb(err)
|
|
1666
|
+
close(this.fd, () => cb(err))
|
|
1667
1667
|
}
|
|
1668
1668
|
}
|
|
1669
1669
|
|
|
@@ -1710,20 +1710,20 @@ class FileReadStream extends Readable {
|
|
|
1710
1710
|
})
|
|
1711
1711
|
}
|
|
1712
1712
|
|
|
1713
|
-
_read (
|
|
1713
|
+
_read (size) {
|
|
1714
1714
|
if (!this._missing) {
|
|
1715
1715
|
this.push(null)
|
|
1716
|
-
return
|
|
1716
|
+
return
|
|
1717
1717
|
}
|
|
1718
1718
|
|
|
1719
|
-
const data = Buffer.allocUnsafe(Math.min(this._missing,
|
|
1719
|
+
const data = Buffer.allocUnsafe(Math.min(this._missing, size))
|
|
1720
1720
|
|
|
1721
1721
|
read(this.fd, data, 0, data.byteLength, this._offset, (err, read) => {
|
|
1722
|
-
if (err) return
|
|
1722
|
+
if (err) return this.destroy(err)
|
|
1723
1723
|
|
|
1724
1724
|
if (!read) {
|
|
1725
1725
|
this.push(null)
|
|
1726
|
-
return
|
|
1726
|
+
return
|
|
1727
1727
|
}
|
|
1728
1728
|
|
|
1729
1729
|
if (this._missing < read) read = this._missing
|
|
@@ -1731,14 +1731,12 @@ class FileReadStream extends Readable {
|
|
|
1731
1731
|
this._missing -= read
|
|
1732
1732
|
this._offset += read
|
|
1733
1733
|
if (!this._missing) this.push(null)
|
|
1734
|
-
|
|
1735
|
-
cb(null)
|
|
1736
1734
|
})
|
|
1737
1735
|
}
|
|
1738
1736
|
|
|
1739
|
-
_destroy (cb) {
|
|
1740
|
-
if (!this.fd) return cb(
|
|
1741
|
-
close(this.fd, () => cb(
|
|
1737
|
+
_destroy (err, cb) {
|
|
1738
|
+
if (!this.fd) return cb(err)
|
|
1739
|
+
close(this.fd, () => cb(err))
|
|
1742
1740
|
}
|
|
1743
1741
|
}
|
|
1744
1742
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-fs",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Native file system for Javascript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"bare-events": "^2.0.0",
|
|
30
30
|
"bare-path": "^2.0.0",
|
|
31
|
-
"bare-stream": "^
|
|
31
|
+
"bare-stream": "^2.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"brittle": "^3.1.1",
|