bare-fs 4.4.0 → 4.4.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/index.js +9 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -20,8 +20,11 @@ class FileRequest {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
static return(req) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// TODO
|
|
24
|
+
// if (this._free.length < 32) this._free.push(req.reset())
|
|
25
|
+
// else req.destroy()
|
|
26
|
+
|
|
27
|
+
req.destroy()
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
constructor() {
|
|
@@ -1470,10 +1473,7 @@ async function readFile(filepath, opts, cb) {
|
|
|
1470
1473
|
} catch (err) {
|
|
1471
1474
|
fail(err, cb)
|
|
1472
1475
|
} finally {
|
|
1473
|
-
if (fd
|
|
1474
|
-
try {
|
|
1475
|
-
await close(fd)
|
|
1476
|
-
} catch {}
|
|
1476
|
+
if (fd !== -1) await close(fd)
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
1479
|
|
|
@@ -1520,10 +1520,7 @@ function readFileSync(filepath, opts) {
|
|
|
1520
1520
|
|
|
1521
1521
|
return buffer
|
|
1522
1522
|
} finally {
|
|
1523
|
-
if (fd
|
|
1524
|
-
try {
|
|
1525
|
-
closeSync(fd)
|
|
1526
|
-
} catch {}
|
|
1523
|
+
if (fd !== -1) closeSync(fd)
|
|
1527
1524
|
}
|
|
1528
1525
|
}
|
|
1529
1526
|
|
|
@@ -1553,10 +1550,7 @@ async function writeFile(filepath, data, opts, cb) {
|
|
|
1553
1550
|
} catch (err) {
|
|
1554
1551
|
fail(err, cb)
|
|
1555
1552
|
} finally {
|
|
1556
|
-
if (fd
|
|
1557
|
-
try {
|
|
1558
|
-
await close(fd)
|
|
1559
|
-
} catch {}
|
|
1553
|
+
if (fd !== -1) await close(fd)
|
|
1560
1554
|
}
|
|
1561
1555
|
}
|
|
1562
1556
|
|
|
@@ -1577,10 +1571,7 @@ function writeFileSync(filepath, data, opts) {
|
|
|
1577
1571
|
if (len === data.byteLength) break
|
|
1578
1572
|
}
|
|
1579
1573
|
} finally {
|
|
1580
|
-
if (fd
|
|
1581
|
-
try {
|
|
1582
|
-
closeSync(fd)
|
|
1583
|
-
} catch {}
|
|
1574
|
+
if (fd !== -1) closeSync(fd)
|
|
1584
1575
|
}
|
|
1585
1576
|
}
|
|
1586
1577
|
|