bare-fs 4.1.0 → 4.1.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.
Files changed (2) hide show
  1. package/index.js +6 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -848,12 +848,14 @@ function ftruncate(fd, len, cb) {
848
848
  )
849
849
  }
850
850
 
851
+ if (typeof len !== 'number') len = 0
852
+
851
853
  const req = getReq()
852
854
  req.callback = cb
853
855
  binding.ftruncate(req.handle, fd, len)
854
856
  }
855
857
 
856
- function ftruncate(fd, len) {
858
+ function ftruncateSync(fd, len) {
857
859
  if (typeof fd !== 'number') {
858
860
  throw typeError(
859
861
  'ERR_INVALID_ARG_TYPE',
@@ -873,6 +875,8 @@ function ftruncate(fd, len) {
873
875
  )
874
876
  }
875
877
 
878
+ if (typeof len !== 'number') len = 0
879
+
876
880
  binding.ftruncateSync(fd, len)
877
881
  }
878
882
 
@@ -2641,6 +2645,7 @@ exports.copyFileSync = copyFileSync
2641
2645
  exports.existsSync = existsSync
2642
2646
  exports.fchmodSync = fchmodSync
2643
2647
  exports.fstatSync = fstatSync
2648
+ exports.ftruncateSync = ftruncateSync
2644
2649
  exports.lstatSync = lstatSync
2645
2650
  exports.mkdirSync = mkdirSync
2646
2651
  exports.openSync = openSync
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Native file system for Javascript",
5
5
  "exports": {
6
6
  "./package": "./package.json",