# @rdf-esm/formats-common

> Parsers and serializers for common RDF formats

Latest version **0.5.6** (published 2022-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rdf-esm/formats-common
pnpm add @rdf-esm/formats-common
yarn add @rdf-esm/formats-common
bun add @rdf-esm/formats-common
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.6 |
| Published | 2022-02-11 |
| First published | 2020-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 6 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Thomas Bergwinkl |
| Maintainers | tpluscode |
| Keywords | rdf, rdfjs, format, parser, serializer |

## Links

- npm: https://www.npmjs.com/package/@rdf-esm/formats-common
- Repository: https://github.com/rdf-esm/formats-common
- Issues: https://github.com/rdf-esm/formats-common/issues
- npm.io page: https://npm.io/package/@rdf-esm/formats-common

## Dependencies (6)

- [@rdfjs/parser-n3](https://npm.io/package/@rdfjs/parser-n3.md) ^1.1.4
- [@rdf-esm/sink-map](https://npm.io/package/@rdf-esm/sink-map.md) ^0.5.5
- [@rdfjs/parser-jsonld](https://npm.io/package/@rdfjs/parser-jsonld.md) ^1.2.2
- [rdfxml-streaming-parser](https://npm.io/package/rdfxml-streaming-parser.md) ^1.5.0
- [@rdfjs/serializer-jsonld](https://npm.io/package/@rdfjs/serializer-jsonld.md) ^1.2.3
- [@rdfjs/serializer-ntriples](https://npm.io/package/@rdfjs/serializer-ntriples.md) ^1.0.3

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.5.6 (latest) — 2022-02-11
- 0.5.5 — 2020-10-09
- 0.5.4 — 2020-10-09
- 0.5.3 — 2020-08-14
- 0.5.2 — 2020-06-12
- 0.5.1 — 2020-06-12
- 0.5.0 — 2020-05-17

## README

# @rdfjs/formats-common

![](https://github.com/rdf-esm/formats-common/workflows/Test/badge.svg)

[![npm version](https://img.shields.io/npm/v/@rdfjs/formats-common.svg)](https://www.npmjs.com/package/@rdfjs/formats-common)

This module bundles parsers and serializers for the most common RDF formats.
Instances of [SinkMap](https://github.com/rdfjs-base/sink-map) are used to handle different media types.

## Fork alert :exclamation:

This package is an ES Modules fork of [@rdfjs/formats-common](https://npm.im/@rdfjs/formats-common).

It uses a [lazy version of `SinkMap`](https://github.com/rdf-esm/sink-map) to dynamically load the sinks.

This way bundlers like webpack will create chunks for them and only load them when they are first needed.

## Usage

The formats object has a `parsers` and `serializers` property.
Each of it is an instance of `SinkMap` with the most common RDF media types as key.

## Example

```javascript
const formats = require('@rdfjs/formats-common')
const Readable = require('stream').Readable

const input = new Readable({
  read: () => {
    input.push(`
      PREFIX s: <http://schema.org/>

      [] a s:Person ;
        s:jobTitle "Professor" ;
        s:name "Jane Doe" ;
        s:telephone "(425) 123-4567" ;
        s:url <http://www.janedoe.com> .
    `)
    input.push(null)
  }
})

const output = formats.parsers.import('text/turtle', input)

output.on('data', quad => {
  console.log(`quad: ${quad.subject.value} - ${quad.predicate.value} - ${quad.object.value}`)
})

output.on('prefix', (prefix, ns) => {
  console.log(`prefix: ${prefix} ${ns.value}`)
})
```

---
_Source: https://npm.io/package/@rdf-esm/formats-common · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
