code: function (endpoint) {
              var deferred = Q.defer(),
                  tmpDir = tmp.dirSync().name,
                  target = endpoint.target == '*' ? 'tip' : endpoint.target,
                  url = endpoint.source + '/archive/' + target + '.zip?auth_token=' + bower.config.rhodecode.token,
                  filePath = tmpDir + '/' + endpoint.name;
  
              bower.logger.debug('rhodecode: repo url', url);
  
              request.get(url)
                  .pipe(fs.createWriteStream(filePath))
                  .on('close', function () {
  
                      try {
                          var buffer = readChunk.sync(filePath, 0, 262),
                              fileType = FileType(buffer),
                              fileExt = (fileType ? fileType.ext : 'txt'),
                              newFilePath = filePath + '.' + fileExt;
  
                          fs.renameSync(filePath, newFilePath);
  
                          if (fileExt === 'zip') {
  
                              var zip = new AdmZip(newFilePath),
                                  extractedDir;
  
                              zip.getEntries().forEach(function (zipEntry) {
                                  zip.extractEntryTo(zipEntry.entryName, tmpDir, true, true);
  
                                  if (typeof extractedDir == 'undefined') {
                                      extractedDir = tmpDir + path.sep + zipEntry.entryName.replace(/(^[^\\\/]+).*/, '$1')
                                  }
  
                              });
  
                              fs.unlink(newFilePath, function () {
                                  deferred.resolve({
                                      tempPath: extractedDir,
                                      removeIgnores: true
                                  });
  
                              });
                          } else {
                              deferred.reject("Invalid file, check on this link", url);
                          }
                      } catch (err) {
                          deferred.reject(err);
                      }
                  })
                  .on('error', function (err) {
                      deferred.reject(err);
                  });
  
              return deferred.promise;
          }
docs: It downloads package and extracts it to temporary directory You can use npm's "tmp" package to tmp directories See the "Resolver API" section for details on this method