File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ function isPromiseFs(fs) {
2020
2121// List of commands all filesystems are expected to provide. `rm` is not
2222// included since it may not exist and must be handled as a special case
23+ // Likewise with `cp`.
2324const commands = [
24- 'cp' ,
2525 'readFile' ,
2626 'writeFile' ,
2727 'mkdir' ,
@@ -45,12 +45,14 @@ function bindFs(target, fs) {
4545 }
4646 }
4747
48- // Handle the special case of `rm`
48+ // Handle the special cases of `rm` and `cp `
4949 if ( isPromiseFs ( fs ) ) {
50+ if ( fs . cp ) target . _cp = fs . cp . bind ( fs )
5051 if ( fs . rm ) target . _rm = fs . rm . bind ( fs )
5152 else if ( fs . rmdir . length > 1 ) target . _rm = fs . rmdir . bind ( fs )
5253 else target . _rm = rmRecursive . bind ( null , target )
5354 } else {
55+ if ( fs . cp ) target . _cp = pify ( fs . cp . bind ( fs ) )
5456 if ( fs . rm ) target . _rm = pify ( fs . rm . bind ( fs ) )
5557 else if ( fs . rmdir . length > 2 ) target . _rm = pify ( fs . rmdir . bind ( fs ) )
5658 else target . _rm = rmRecursive . bind ( null , target )
You can’t perform that action at this time.
0 commit comments