# @rdfjs/to-ntriples

> Converts RDF/JS Terms, Quads and Datasets to N-Triple strings

Latest version **3.0.1** (published 2024-02-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rdfjs/to-ntriples
pnpm add @rdfjs/to-ntriples
yarn add @rdfjs/to-ntriples
bun add @rdfjs/to-ntriples
```

## Health

**Score 43/100 (D)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2024-02-09 |
| First published | 2018-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/rdfjs__to-ntriples) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Thomas Bergwinkl |
| Maintainers | bergos |
| Keywords | rdf, rdfjs, ntriples, string |

## Links

- npm: https://www.npmjs.com/package/@rdfjs/to-ntriples
- Repository: https://github.com/rdfjs-base/to-ntriples
- Issues: https://github.com/rdfjs-base/to-ntriples/issues
- npm.io page: https://npm.io/package/@rdfjs/to-ntriples

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 3.0.1 (latest) — 2024-02-09
- 3.0.0 — 2024-02-09
- 2.0.0 — 2021-07-01
- 1.0.2 — 2019-07-29
- 1.0.1 — 2018-10-01
- 1.0.0 — 2018-07-11

## README

# @rdfjs/to-ntriples
[![build status](https://img.shields.io/github/actions/workflow/status/rdfjs-base/to-ntriples/test.yaml?branch=master)](https://github.com/rdfjs-base/to-ntriples/actions/workflows/test.yaml)
[![npm version](https://img.shields.io/npm/v/@rdfjs/to-ntriples.svg)](https://www.npmjs.com/package/@rdfjs/to-ntriples)

Converts [RDF/JS](http://rdf.js.org/) Terms, Quads and Datasets to N-Triple strings. 

## Examples

```javascript
import rdf from '@rdfjs/data-model'
import toNT from '@rdfjs/to-ntriples'

// convert a Term/Literal to a N-Triple string (output: "example"@en)
console.log(toNT(rdf.literal('example', 'en')))

// convert a Quad to a N-Triple string (output: _:b1 <http://example.org/predicate> "example" .) 
console.log(toNT(rdf.quad(
  rdf.blankNode(),
  rdf.namedNode('http://example.org/predicate'),
  rdf.literal('example')
)))


/*
  convert an Array/Dataset to a N-Triple string
  output:
    _:b2 <http://example.org/predicate> "1" .
    _:b3 <http://example.org/predicate> "2" .
  Any object with Symbol.iterator is supported
*/
console.log(toNT([
  rdf.quad(
    rdf.blankNode(),
    rdf.namedNode('http://example.org/predicate'),
    rdf.literal('1')
  ),
  rdf.quad(
    rdf.blankNode(),
    rdf.namedNode('http://example.org/predicate'),
    rdf.literal('2')
  )
]))
```

---
_Source: https://npm.io/package/@rdfjs/to-ntriples · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
