1.0.0 • Published 8 years ago
rdf-fetch v1.0.0
RDF-Ext Fetch
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
fetchcan be used to replace the default isomorphic-fetch Fetch library.formatscan be used to replace the default parser and serializer bundle rdf-formats-commons.