@@ -15,7 +15,6 @@ module.exports = class FS {
1515 this . _backend = new IdbBackend ( name ) ;
1616 this . _cache = new CacheFS ( name ) ;
1717 this . saveSuperblock = debounce ( ( ) => {
18- console . log ( "saving superblock" ) ;
1918 this . _saveSuperblock ( ) ;
2019 } , 500 ) ;
2120 if ( url ) {
@@ -26,6 +25,15 @@ module.exports = class FS {
2625 } else {
2726 this . superblockPromise = this . _loadSuperblock ( ) ;
2827 }
28+ // Needed so things don't break if you pass individual functions to `pify` etc
29+ this . readFile = this . readFile . bind ( this )
30+ this . writeFile = this . writeFile . bind ( this )
31+ this . unlink = this . unlink . bind ( this )
32+ this . mkdir = this . mkdir . bind ( this )
33+ this . rmdir = this . rmdir . bind ( this )
34+ this . readdir = this . readdir . bind ( this )
35+ this . stat = this . stat . bind ( this )
36+ this . lstat = this . lstat . bind ( this )
2937 }
3038 _cleanParams ( filepath , opts , cb , stopClock = null , save = false ) {
3139 filepath = path . normalize ( filepath ) ;
@@ -104,9 +112,7 @@ module.exports = class FS {
104112 cb ( null , data ) ;
105113 } )
106114 . catch ( err => {
107- console . log ( "filepath" , filepath ) ;
108- console . log ( err ) ;
109- console . log ( "readFile: stat data out of sync with db" ) ;
115+ console . log ( "ERROR: readFile: stat data out of sync with db:" , filepath ) ;
110116 } ) ;
111117 } )
112118 . catch ( cb ) ;
@@ -127,10 +133,7 @@ module.exports = class FS {
127133 try {
128134 this . _cache . writeFile ( filepath , data , { mode } ) ;
129135 } catch ( err ) {
130- console . log ( "filepath" , filepath ) ;
131- console . log ( err ) ;
132- console . log ( "writeFile: cache corrupted - unable to keep cache in sync with db" ) ;
133- return cb ( new ENOENT ( ) ) ;
136+ return cb ( err ) ;
134137 }
135138 this . _backend . writeFile ( filepath , data )
136139 . then ( ( ) => cb ( null ) )
0 commit comments