bedrock-jsonld-document-loader

1.3.0 • Public • Published

JSON-LD Document Loader (bedrock-jsonld-document-loader)

Build Status NPM Version

A document loader API for jsonld.js and the Bedrock ecosystem.

Table of Contents

Background

TBD

Security

TBD

Install

  • Node.js 12+ is required.

NPM

To install via NPM:

npm install --save bedrock-jsonld-document-loader

Development

To install locally (for development):

git clone https://github.com/digitalbazaar/bedrock-jsonld-document-loader.git
cd bedrock-jsonld-document-loader
npm install

Usage

This library exports the following things:

  1. A jsonLdDocumentLoader instance.
  2. A default documentLoader function (with an instance bound to it).
  3. An httpClientHandler, for use with cfg.documentLoader.mode === 'web'.
import {documentLoader} from 'bedrock-jsonld-document-loader';
// or
const {documentLoader} = require('bedrock-jsonld-document-loader');

Enabling the HTTP/HTTPS protocol handler

import bedrock from 'bedrock';
const {config: {'your-project': cfg}} = bedrock;

// Import the loader instance, and not the 'documentLoader' function directly.
import {jsonLdDocumentLoader, httpClientHandler} from 'bedrock-jsonld-document-loader';

// if enabled, add loader for remote documents
if(cfg.documentLoader.mode === 'web') {
  jsonLdDocumentLoader.setProtocolHandler({protocol: 'http', handler: httpClientHandler});
  jsonLdDocumentLoader.setProtocolHandler({protocol: 'https', handler: httpClientHandler});
}

export const documentLoader = jsonLdDocumentLoader.build();

Contribute

See the contribute file!

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

Commercial Support

Commercial support for this library is available upon request from Digital Bazaar: support@digitalbazaar.com

License

Bedrock Non-Commercial License v1.0 © Digital Bazaar

Package Sidebar

Install

npm i bedrock-jsonld-document-loader

Weekly Downloads

1

Version

1.3.0

License

SEE LICENSE IN LICENSE.md

Unpacked Size

20.2 kB

Total Files

15

Last publish

Collaborators

  • msporny
  • dlongley
  • davidlehn
  • mattcollier
  • gannan