# @rdfjs/io

> I/O operations for RDF/JS streams and datasets

Latest version **1.2.0** (published 2024-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rdfjs/io
pnpm add @rdfjs/io
yarn add @rdfjs/io
bun add @rdfjs/io
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2024-10-12 |
| First published | 2023-11-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 40.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Thomas Bergwinkl |
| Maintainers | bergos |
| Keywords | input, io, output, rdf, rdfjs |

## Links

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

## Dependencies (3)

- [duplex-to](https://npm.io/package/duplex-to.md) ^2.0.0
- [stream-chunks](https://npm.io/package/stream-chunks.md) ^1.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^4.4.2

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2024-10-12
- 1.1.1 — 2024-05-25
- 1.1.0 — 2024-05-25
- 1.0.0 — 2023-11-24

## README

# @rdfjs/io

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

This package provides I/O operations for RDF/JS streams and datasets.

## Usage

Depending on which kind of objects should be used for the I/O operations, there are three different options to import this package:

To import both, streams and datasets operations, use the main entrypoint:

```js
import * as io from '@rdfjs/io'
```

If only dataset operations are required:

```js
import * as datasetIo from '@rdfjs/io/dataset.js'
```

And, if only stream operations are required:

```js
import * as streamIo from '@rdfjs/io/stream.js'
```

### Factory Argument

All operations require a factory argument.
The factory must be an [Environment](https://www.npmjs.com/package/@rdfjs/environment) that bundles multiple other factories.
[FetchFactory](https://www.npmjs.com/package/@rdfjs/fetch-lite) and [FormatsFactory](https://www.npmjs.com/package/@rdfjs/formats) are required for the stream operations.
Additionally, the [DatasetFactory](https://www.npmjs.com/package/@rdfjs/dataset) is required for dataset operations.

## Examples

The following example loads a dataset from the given URL:

```js
import * as io from '@rdfjs/io'
import factory from './factory.js'

const url = 'https://housemd.rdf-ext.org/person/gregory-house'
const dataset = await io.dataset.fromURL(url, { factory })
```

The following example loads the quads of the given URL as a stream of quads:

```js
import * as io from '@rdfjs/io'
import factory from './factory.js'

const url = 'https://housemd.rdf-ext.org/person/gregory-house'
const stream = io.stream.fromURL(url, { factory })
```

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