Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hyperfetch

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperfetch

Fetch JSON-LD from any URI if possible

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Hyperfetch

Hyperfetch tries to fetch JSON-LD from any URI.

Quickstart

import hyperfetch from 'hyperfetch'

hyperfetch('https://api.example/resource').then(jsonld => {
  console.log(jsonld)
});

Supported Content-Types

A resource representation may be delivered as one of the following Content-Types:

  • application/ld+json
  • application/rdf+xml
  • application/trig
  • application/n-quads
  • application/n-triples
  • text/n3
  • text/turtle

For any supported Content-Type, hyperfetch will return a JSON-LD object!

Unsupported Content-Types cause an error.

Passing custom options

You may pass an options object as second argument, to set for example HTTP headers or use a specific implementation of fetch.

hyperfetch('https://api.example/resource', {
  // custom options
})

For details see documentation of the underlying library @rdfjs/fetch-lite

Storing data to hyperfact

The data retrieved by hyperfetch can directly be merged to a hyperfact store:


import hyperfetch from 'hyperfetch';
import createStore from 'hyperfact';

export const facts = createStore();

hyperfetch("https://api.example/resource")
  .then(resource => facts.merge(resource))

Keywords

FAQs

Package last updated on 28 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc