File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const path = require("./path.js");
1313module . exports = class DefaultBackend {
1414 constructor ( ) {
1515 this . saveSuperblock = debounce ( ( ) => {
16- this . _saveSuperblock ( ) ;
16+ this . flush ( ) ;
1717 } , 500 ) ;
1818 }
1919 async init ( name , {
@@ -180,4 +180,7 @@ module.exports = class DefaultBackend {
180180 du ( filepath ) {
181181 return this . _cache . du ( filepath ) ;
182182 }
183+ flush ( ) {
184+ return this . _saveSuperblock ( ) ;
185+ }
183186}
Original file line number Diff line number Diff line change @@ -198,4 +198,7 @@ module.exports = class PromisifiedFS {
198198 async du ( filepath ) {
199199 return this . _backend . du ( filepath ) ;
200200 }
201+ async flush ( ) {
202+ return this . _backend . flush ( ) ;
203+ }
201204}
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ module.exports = class FS {
2929 this . symlink = this . symlink . bind ( this )
3030 this . backFile = this . backFile . bind ( this )
3131 this . du = this . du . bind ( this )
32+ this . flush = this . flush . bind ( this )
3233 }
3334 init ( name , options ) {
3435 return this . promises . init ( name , options )
@@ -85,4 +86,8 @@ module.exports = class FS {
8586 const [ resolve , reject ] = wrapCallback ( cb ) ;
8687 this . promises . du ( filepath ) . then ( resolve ) . catch ( reject ) ;
8788 }
89+ flush ( cb ) {
90+ const [ resolve , reject ] = wrapCallback ( cb ) ;
91+ this . promises . flush ( ) . then ( resolve ) . catch ( reject ) ;
92+ }
8893}
You can’t perform that action at this time.
0 commit comments