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");
13
13
module . exports = class DefaultBackend {
14
14
constructor ( ) {
15
15
this . saveSuperblock = debounce ( ( ) => {
16
- this . _saveSuperblock ( ) ;
16
+ this . flush ( ) ;
17
17
} , 500 ) ;
18
18
}
19
19
async init ( name , {
@@ -180,4 +180,7 @@ module.exports = class DefaultBackend {
180
180
du ( filepath ) {
181
181
return this . _cache . du ( filepath ) ;
182
182
}
183
+ flush ( ) {
184
+ return this . _saveSuperblock ( ) ;
185
+ }
183
186
}
Original file line number Diff line number Diff line change @@ -198,4 +198,7 @@ module.exports = class PromisifiedFS {
198
198
async du ( filepath ) {
199
199
return this . _backend . du ( filepath ) ;
200
200
}
201
+ async flush ( ) {
202
+ return this . _backend . flush ( ) ;
203
+ }
201
204
}
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ module.exports = class FS {
29
29
this . symlink = this . symlink . bind ( this )
30
30
this . backFile = this . backFile . bind ( this )
31
31
this . du = this . du . bind ( this )
32
+ this . flush = this . flush . bind ( this )
32
33
}
33
34
init ( name , options ) {
34
35
return this . promises . init ( name , options )
@@ -85,4 +86,8 @@ module.exports = class FS {
85
86
const [ resolve , reject ] = wrapCallback ( cb ) ;
86
87
this . promises . du ( filepath ) . then ( resolve ) . catch ( reject ) ;
87
88
}
89
+ flush ( cb ) {
90
+ const [ resolve , reject ] = wrapCallback ( cb ) ;
91
+ this . promises . flush ( ) . then ( resolve ) . catch ( reject ) ;
92
+ }
88
93
}
You can’t perform that action at this time.
0 commit comments