lib/extensions.js
function getBinaryCachePath() {
  var i,
    cachePath,
    cachePathCandidates = getCachePathCandidates();

  for (i = 0; i < cachePathCandidates.length; i++) {
    cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version);

    try {
      mkdir.sync(cachePath);
      return cachePath;
    } catch (e) {
      // Directory is not writable, try another
    }
  }

  return '';
}
function getBinaryCachePath() {
  var i,
    cachePath,
    cachePathCandidates = getCachePathCandidates();

  for (i = 0; i < cachePathCandidates.length; i++) {
    cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version);

    try {
      mkdir.sync(cachePath);
      return cachePath;
    } catch (e) {
      // Directory is not writable, try another
    }
  }

  return '';
}
function getBinaryCachePath ( ) { var i , cachePath , cachePathCandidates = getCachePathCandidates ( ) ; for ( i = 0 ; i < cachePathCandidates . length ; i ++ ) { cachePath = path . join ( cachePathCandidates [ i ] , pkg . name , pkg . version ) ; try { mkdir . sync ( cachePath ) ; return cachePath ; } catch ( e ) { // Directory is not writable, try another } } return '' ; }
The most suitable location for caching the binding on disk.

Given the candidates directories provided by `getCachePathCandidates()` this
returns the first writable directory. By treating the candidate directories
as a prioritised list this method is deterministic, assuming no change to the
local environment.

@return {String} directory to cache binding
@api public
The most suitable location for caching the binding on disk .