Requests the /pins/hash endpoint and try to load the hash afterwards
@param {string} hash ipfs hash to pin
334215
function (hash) {
  console.log('Pinning to IPFS...');

  return new Promise((resolve, reject) => {
    const options = {
      hostname: ipfsHost,
      port: ipfsProtocol === 'https' ? '443' : '8080',
      path: `/pins/${hash}`,
      method: 'POST'
    }

    const req = https.request(options, (res) => {
      res.setEncoding('utf8')
      res.on('data', (chunk) => { })
      res.on('end', () => resolve())
    })

    req.on('error', async (ex) => reject(new Error(`failed to pin hash "${hash}"; ${e.message || e}`)))
    req.on('timeout', async () => reject(new Error(`timeout during pinning of hash "${hash}"`)))

    req.write('')
    req.end()
  })
  .then(() => requestFileFromEVANIpfs(hash));
}
156673
def http_get(path, extra=nil, params={})
      payload = self.class.get path, params
      APICake::Payload.new payload
    end
1096814
function (hash) {
            var iframe = this._iframe;
            if (!iframe) {
                return;
            }
            hash = hash || "";
            if (this._currentIframeHashString != hash) {
                var src = ['javascript:document.open();'];
                src.push('document.write(\"<script type=\\\"text/javascript\\\">');
                if (Aria.domain) {
                    src.push('document.domain=\\\"' + Aria.domain + '\\\";');
                }
                src.push('if (parent.' + this.$classpath + '){parent.' + this.$classpath
                        + '.polledIframeHashString=\\\"' + hash + '\\\";}');
                src.push("</script>\");");
                src.push('document.close();');
                iframe.src = src.join("");
                this._currentIframeHashString = hash;
            }
        }
1205936
function Requests(apiUrl, version, publicKey) {
    this.apiUrl = stripSlashes(apiUrl);
    this.version = version.toString();
    this.publicKey = publicKey;
}
685796
async function maybeApi ({ apiAddress, apiOpts, ipfsConnectionTest, IpfsApi }) {
  try {
    const ipfs = new IpfsApi(apiAddress, apiOpts)
    await ipfsConnectionTest(ipfs)
    return { ipfs, provider, apiAddress }
  } catch (error) {
    console.log('Failed to connect to ipfs-api', apiAddress)
  }
}
229961
def _endpoint_from_socksport_line(reactor, socks_config):
    
    if socks_config.startswith('unix:'):
        # XXX wait, can SOCKSPort lines with "unix:/path" still
        # include options afterwards? What about if the path has a
        # space in it?
        return UNIXClientEndpoint(reactor, socks_config[5:])

    # options like KeepAliveIsolateSOCKSAuth can be appended
    # to a SocksPort line...
    if ' ' in socks_config:
        socks_config = socks_config.split()[0]
    if ':' in socks_config:
        host, port = socks_config.split(':', 1)
        port = int(port)
    else:
        host = '127.0.0.1'
        port = int(socks_config)
    return TCP4ClientEndpoint(reactor, host, port)
325845
def submit(ruby_service_hash)
      aws_request = AwsRequestV4.new(self, ruby_service_hash)
      begin
        RestClient::Request.execute(
          :method => :post,
          :url => aws_request.url,
          :payload => aws_request.payload,
          :headers => aws_request.headers,
          :timeout => @timeout
        )
      rescue RestClient::BadRequest => e
        type, message = AwsSession.parse_error_response(e.http_body)
        raise ThrottlingException, message if type == 'ThrottlingException'
        raise ArgumentError, message
      end
    end
233959
private void onFinishLoading() {
    // save the current hash
    String hashOnStart = this.plugin.getStartRoute(isUsingHash());
    // check if the url contains a hash.
    // in case it has a hash, use this to route otherwise
    // use the startRoute from the annotation
    if (hashOnStart != null &&
        hashOnStart.trim()
                   .length() > 0) {
      ClientLogger.get()
                  .logDetailed("AbstractApplication: handle history (hash at start: >>" + hashOnStart + "<<",
                               1);
      RouteResult routeResult;
      try {
        routeResult = this.router.parse(hashOnStart);
      } catch (RouterException e) {
        return;
      }
      this.router.route(routeResult.getRoute(),
                        routeResult.getParameterValues()
                                   .toArray(new String[0]));
    } else {
      ClientLogger.get()
                  .logDetailed("AbstractApplication: no history found -> use startRoute: >>" + this.startRoute + "<<",
                               1);
      this.router.route(this.startRoute);
    }
    ClientLogger.get()
                .logSimple("AbstractApplication: application started",
                           0);
  }
494094
def pin_assets(self, file_or_dir_path: Path) -> List[Dict[str, str]]:
        
        if file_or_dir_path.is_dir():
            asset_data = [dummy_ipfs_pin(path) for path in file_or_dir_path.glob("*")]
        elif file_or_dir_path.is_file():
            asset_data = [dummy_ipfs_pin(file_or_dir_path)]
        else:
            raise FileNotFoundError(
                f"{file_or_dir_path} is not a valid file or directory path."
            )
        return asset_data
51168
def get_token_from_hash(hash)
      access_token = hash.delete('access_token') || hash.delete(:access_token) || hash.delete('oauth_token') || hash.delete(:oauth_token)
      opts = {:expires_at => hash["expires"] || hash[:expires],
              :header_format => "OAuth2 %s",
              :param_name => "access_token"}
      
      @token = OAuth2::AccessToken.new(self, access_token, opts)
    end
596680
function handleHashChange() {
  var prefix = '#pipeline-';
  var hash = location.hash;
  var pieces = hash.split(';', 2);
  var pipelineId = null;

  if (pieces[0].indexOf(prefix) == 0) {
    pipelineId = pieces[0].substr(prefix.length);
  } else {
    // Bad hash, just show the root pipeline.
    location.hash = '';
    return;
  }

  if (!pipelineId) {
    // No hash means show the root pipeline.
    pipelineId = STATUS_MAP.rootPipelineId;
  }
  var rootMap = STATUS_MAP.pipelines[STATUS_MAP.rootPipelineId];
  var infoMap = STATUS_MAP.pipelines[pipelineId];
  if (!rootMap || !infoMap) {
    // Hash not found.
    return;
  }

  // Clear any selection styling.
  $('.selected-link').removeClass('selected-link');

  if (pieces[1]) {
    // Show a specific status link.
    var statusLink = $(getTreePipelineElementId(pipelineId))
        .find('.status-links>a:contains("' + pieces[1] + '")');
    if (statusLink.size() > 0) {
      var selectedLink = $(statusLink[0]);
      selectedLink.addClass('selected-link');
      $('#status-console').attr('src', selectedLink.attr('href'));
      $('#status-console').show();
    } else {
      // No console link for this pipeline; ignore it.
      $('#status-console').hide();
    }
  } else {
    // Show the console link.
    var consoleLink = $(getTreePipelineElementId(pipelineId))
        .find('a.status-console');
    if (consoleLink.size() > 0) {
      var selectedLink = $(consoleLink[0]);
      selectedLink.addClass('selected-link');
      $('#status-console').attr('src', selectedLink.attr('href'));
      $('#status-console').show();
    } else {
      // No console link for this pipeline; ignore it.
      $('#status-console').hide();
    }
  }

  // Mark the pipeline as selected.
  var selected = $('#link-pipeline-' + pipelineId);
  selected.addClass('selected-link');
  selected.parents('.status-box').addClass('selected-link');

  // Title is always the info for the root pipeline, to make it easier to
  // track across multiple tabs.
  document.title = rootMap.classPath + ' - ID #' + STATUS_MAP.rootPipelineId;

  // Update the detail status frame.
  var stageNode = constructStageNode(pipelineId, infoMap, false);
  $('#overview').remove();
  stageNode.attr('id', 'overview');
  $('#detail').append(stageNode);

  // Make sure everything is the right size.
  adjustStatusConsole();
}
476738
function snapshotToHash(snap, idProp = "id") {
    const hash = snap.val() || {};
    Object.keys(hash).forEach(key => typeof hash[key] === "object"
        ? (hash[key][idProp] = key)
        : (hash[key] = { [idProp]: key, value: hash[key] }));
    return hash;
}
1372332
def get(path, params = {})
      headers = request_headers(:get, path, params)
      request(:get, path, params, headers)
    end
565523
function makeHttpRequests(options, fileHashes) {
    if (options.verbose) {
        _utils.logger.info('Performing HTTP requests...');
    }
    var promises = [];
    var _iteratorNormalCompletion4 = true;
    var _didIteratorError4 = false;
    var _iteratorError4 = undefined;

    try {
        for (var _iterator4 = fileHashes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
            var fileWithHash = _step4.value;

            if (fileWithHash.subtitlesPresent) continue;
            if (options.verbose) {
                _utils.logger.info('Downloading subtitles for file [%s] with hash [%s]', fileWithHash.file, fileWithHash.hash);
            }
            var httpRequest = new _utils.HttpRequest(options, fileWithHash);
            promises.push(httpRequest.request());
        }
    } catch (err) {
        _didIteratorError4 = true;
        _iteratorError4 = err;
    } finally {
        try {
            if (!_iteratorNormalCompletion4 && _iterator4.return) {
                _iterator4.return();
            }
        } finally {
            if (_didIteratorError4) {
                throw _iteratorError4;
            }
        }
    }

    return Promise.all(promises);
}
1371750
public File getFile(String hash)
   {
      // work with digest
      return new File(channel.rootDir, channel.makeFilePath(hash, 0));
   }
105214
function parseUrlHash_(hash) {
    const parameters = hash.split('&');

    let tabHash = parameters[0];
    if (tabHash === '' || tabHash === '#') {
      tabHash = undefined;
    }

    // Split each string except the first around the '='.
    let paramDict = null;
    for (let i = 1; i < parameters.length; i++) {
      const paramStrings = parameters[i].split('=');
      if (paramStrings.length !== 2) {
        continue;
      }
      if (paramDict === null) {
        paramDict = {};
      }
      const key = decodeURIComponent(paramStrings[0]);
      const value = decodeURIComponent(paramStrings[1]);
      paramDict[key] = value;
    }

    return {tabHash, parameters: paramDict};
  }
1093390
function _pollHash(){
        if (!_listenerWindow) {
            return;
        }
        var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#");
        if (indexOf != -1) {
            hash = href.substring(indexOf);
        }
        if (hash && hash != _lastMsg) {
            _handleHash(hash);
        }
    }