code: function rimrafSync (p, options) {
    let st
  
    options = options || {}
    defaults(options)
  
    assert(p, 'rimraf: missing path')
    assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
    assert(options, 'rimraf: missing options')
    assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
  
    try {
      st = options.lstatSync(p)
    } catch (er) {
      if (er.code === 'ENOENT') {
        return
      }
  
      // Windows can EPERM on stat.  Life is suffering.
      if (er.code === 'EPERM' && isWindows) {
        fixWinEPERMSync(p, options, er)
      }
    }
  
    try {
      // sunos lets the root user unlink directories, which is... weird.
      if (st && st.isDirectory()) {
        rmdirSync(p, options, null)
      } else {
        options.unlinkSync(p)
      }
    } catch (er) {
      if (er.code === 'ENOENT') {
        return
      } else if (er.code === 'EPERM') {
        return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
      } else if (er.code !== 'EISDIR') {
        throw er
      }
      rmdirSync(p, options, er)
    }
  }
docs: this looks simpler, and is strictly *faster*, but will tie up the JavaScript thread and fail on excessively deep directory trees.