1.0.0 • Published 7 years ago

rdf-fetch v1.0.0

Weekly downloads
12
License
MIT
Repository
github
Last release
7 years ago

RDF-Ext Fetch

Build Status npm version

Uses Fetch to send and receive RDFJS quad streams over HTTP. rdf-format-commons is used to serialize and parse the quads.

Usage

rdf-fetch serializes the quad stream given in the body options based on the Content-Type header, rdfFetch.defaults.contentType or the first serializer found in the formats bundle. The response object contains the quadStream methods which returns parser stream as a Promise.

const rdfFetch = require('rdf-fetch')

rdfFetch('http://...', {method: 'post', body: requestStream}).then((response) => {
  return response.quadStream()
}).then((responseStream) => {
  ...
})

The dataset method of the response pipes the quad stream into a Dataset and returns it as a Promise.

rdfFetch('http://...', {method: 'post', body: requestStream}).then((response) => {
  return response.dataset()
}).then((dataset) => {
  ...
})

Examples

The examples folder contains examples how to send and receive quads.

Options