npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsonld-cli

v2.0.0

Published

A JSON-LD command line interface tool.

Downloads

241

Readme

jsonld-cli

Introduction

This module provides a command line tool jsonld to manipulate JSON-LD data. It is written in JavaScript for Node.js and uses the jsonld.js and jsonld-request libraries. Inputs can be from stdin, URLs, or files.

Requirements

Installation

Install from NPM

npm install -g jsonld-cli

Use directly with npx

npx jsonld-cli ...

Usage

The jsonld command line tool can be used to:

  • Check JSON-LD for various problematic data.
  • Transform JSON-LD to compact, expanded, flattened, or canonized form.
  • Transform RDFa to JSON-LD.
  • Canonize JSON-LD/RDFa Datasets to N-Quads.

To show tool options, a list of commands, or command options:

jsonld --help
jsonld COMMAND --help

To check JSON-LD for some common problems:

jsonld lint "https://example.com/data.json"

To compact a document on the Web using a JSON-LD context published on the Web:

jsonld compact -c "https://w3id.org/payswarm/v1" "http://recipes.payswarm.com/?p=10554"

The command above will read in a PaySwarm Asset and Listing in RDFa 1.0 format, convert it to JSON-LD expanded form, compact it using the 'https://w3id.org/payswarm/v1' context, and dump it out to the console in compacted form.

jsonld canonize -q "http://recipes.payswarm.com/?p=10554"

The command above will read in a PaySwarm Asset and Listing in RDFa 1.0 format, canonize the data using the RDF Dataset canonicalization algorithm, and then dump the output to canonized N-Quads format. The N-Quads can then be processed via SHA-256, or similar algorithm, to get a deterministic hash of the contents of the Dataset.

Security Considerations

  • This tool is able to read stdin, local files, and remote resources.
  • Loading of remote resources may reveal aspects of the data being processed.
  • Input data may recursively load remote resources.
  • Input data may load arbitrary local files if allowed.
  • Processing data that uses untrusted remote resources could result in unexpected output.

Commercial Support

Commercial support for this library is available upon request from Digital Bazaar: [email protected]

Source Code

https://github.com/digitalbazaar/jsonld-cli