index.js
function directory_path () {
      pending++
      readdir(entry, (err, children) => {
        if (err) return done(err)

        // Push children into pipeline, order is not important
        for (var i = children.length; i--;) {
          if (path !== null && base !== null) {
            files.push({ base, path: join(path, children[i]) })
          } else if (path !== null) {
            files.push({ base: null, path: join(path, children[i]) })
          } else {
            files.push({ base, path: children[i] })
          }
        }

        // Filter directory out of pipeline after adding children files
        pending--
        done(null, null)
      })
    }
function directory_path () {
      pending++
      readdir(entry, (err, children) => {
        if (err) return done(err)

        // Push children into pipeline, order is not important
        for (var i = children.length; i--;) {
          if (path !== null && base !== null) {
            files.push({ base, path: join(path, children[i]) })
          } else if (path !== null) {
            files.push({ base: null, path: join(path, children[i]) })
          } else {
            files.push({ base, path: children[i] })
          }
        }

        // Filter directory out of pipeline after adding children files
        pending--
        done(null, null)
      })
    }
function directory_path ( ) { pending ++ readdir ( entry , ( err , children ) => { if ( err ) return done ( err ) // Push children into pipeline, order is not important for ( var i = children . length ; i -- ; ) { if ( path !== null && base !== null ) { files . push ( { base , path : join ( path , children [ i ] ) } ) } else if ( path !== null ) { files . push ( { base : null , path : join ( path , children [ i ] ) } ) } else { files . push ( { base , path : children [ i ] } ) } } // Filter directory out of pipeline after adding children files pending -- done ( null , null ) } ) }
If path is directory, read their children and push more onto `paths` This is the recursive operation that creates more file in the pipeline
If path is directory read their children and push more onto paths This is the recursive operation that creates more file in the pipeline