lib/mem-fs-utils.js
function (storeOrEditor, from, to) {
    debug('Performing inMemoryCopy from ' + from + ' to ' + to + '.');
    var fromLen = from.length;
    this.processInMemoryStore(storeOrEditor, (file, store) => {
      var idx = file.path.indexOf(from);
      if (idx === 0 && file.contents !== null && file.state !== 'deleted') {
        var absTo = path.join(to, file.path.substr(fromLen));
        // exact match so we are copying a single file and not a folder
        if (fromLen === file.path.length) {
          absTo = path.join(to, path.basename(file.path));
        }
        debug('CREATING COPY IN-MEMORY: ' + absTo);
        var newFile = store.get(absTo);
        newFile.contents = file.contents;
        newFile.state = 'modified';
        store.add(newFile);
      }
    });
  }
function (storeOrEditor, from, to) {
    debug('Performing inMemoryCopy from ' + from + ' to ' + to + '.');
    var fromLen = from.length;
    this.processInMemoryStore(storeOrEditor, (file, store) => {
      var idx = file.path.indexOf(from);
      if (idx === 0 && file.contents !== null && file.state !== 'deleted') {
        var absTo = path.join(to, file.path.substr(fromLen));
        // exact match so we are copying a single file and not a folder
        if (fromLen === file.path.length) {
          absTo = path.join(to, path.basename(file.path));
        }
        debug('CREATING COPY IN-MEMORY: ' + absTo);
        var newFile = store.get(absTo);
        newFile.contents = file.contents;
        newFile.state = 'modified';
        store.add(newFile);
      }
    });
  }
function ( storeOrEditor , from , to ) { debug ( 'Performing inMemoryCopy from ' + from + ' to ' + to + '.' ) ; var fromLen = from . length ; this . processInMemoryStore ( storeOrEditor , ( file , store ) => { var idx = file . path . indexOf ( from ) ; if ( idx === 0 && file . contents !== null && file . state !== 'deleted' ) { var absTo = path . join ( to , file . path . substr ( fromLen ) ) ; // exact match so we are copying a single file and not a folder if ( fromLen === file . path . length ) { absTo = path . join ( to , path . basename ( file . path ) ) ; } debug ( 'CREATING COPY IN-MEMORY: ' + absTo ) ; var newFile = store . get ( absTo ) ; newFile . contents = file . contents ; newFile . state = 'modified' ; store . add ( newFile ) ; } } ) ; }
Given the path for a virtual file or folder and a destination path perform a copy
completely within mem-fs.

@param {!Store|!EditionInterface} storeOrEditor
@param {string} from - file path or folder path
@param {string} to - folder path
Given the path for a virtual file or folder and a destination path perform a copy completely within mem - fs .