@@ -273,7 +273,7 @@ MemoryFileSystem.prototype.createWriteStream = function(path, options) {
273
273
274
274
// async functions
275
275
276
- [ "stat" , "readdir" , "mkdirp" , "mkdir" , " rmdir", "unlink" , "readlink" ] . forEach ( function ( fn ) {
276
+ [ "stat" , "readdir" , "mkdirp" , "rmdir" , "unlink" , "readlink" ] . forEach ( function ( fn ) {
277
277
MemoryFileSystem . prototype [ fn ] = function ( path , callback ) {
278
278
try {
279
279
var result = this [ fn + "Sync" ] ( path ) ;
@@ -284,23 +284,25 @@ MemoryFileSystem.prototype.createWriteStream = function(path, options) {
284
284
} ;
285
285
} ) ;
286
286
287
+ [ "mkdir" , "readFile" ] . forEach ( function ( fn ) {
288
+ MemoryFileSystem . prototype [ fn ] = function ( path , optArg , callback ) {
289
+ if ( ! callback ) {
290
+ callback = optArg ;
291
+ optArg = undefined ;
292
+ }
293
+ try {
294
+ var result = this [ fn + "Sync" ] ( path , optArg ) ;
295
+ } catch ( e ) {
296
+ return callback ( e ) ;
297
+ }
298
+ return callback ( null , result ) ;
299
+ } ;
300
+ } ) ;
301
+
287
302
MemoryFileSystem . prototype . exists = function ( path , callback ) {
288
303
return callback ( this . existsSync ( path ) ) ;
289
304
}
290
305
291
- MemoryFileSystem . prototype . readFile = function ( path , optArg , callback ) {
292
- if ( ! callback ) {
293
- callback = optArg ;
294
- optArg = undefined ;
295
- }
296
- try {
297
- var result = this . readFileSync ( path , optArg ) ;
298
- } catch ( e ) {
299
- return callback ( e ) ;
300
- }
301
- return callback ( null , result ) ;
302
- } ;
303
-
304
306
MemoryFileSystem . prototype . writeFile = function ( path , content , encoding , callback ) {
305
307
if ( ! callback ) {
306
308
callback = encoding ;
0 commit comments