New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

opds-ts

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opds-ts

A TypeScript library for generating and parsing OPDS feeds with full TypeScript support.

latest
Source
npmnpm
Version
2.1.0
Version published
Weekly downloads
195
-1.52%
Maintainers
1
Weekly downloads
 
Created
Source

opds-ts

npm npm Discord

A TypeScript library for generating and parsing OPDS feeds (v1.2) with a fluent API. Designed to be extendable for future OPDS v2 support.

Features

  • Fully TypeScript typed.
  • Fluent API for constructing Feed and Entry objects.
  • Relative URL resolution to absolute URLs.
  • Support for extra metadata / vendor-specific attributes.
  • Output as pretty or compact XML.
  • Parse from XML.
  • Helpers for common OPDS links like navigation or acquisition.

Installation

npm install opds-ts

Importing

When importing make sure to use the right version. E.g.:

import { Feed, Entry } from 'opds-ts/v1.2';

or

import * as opdsv2 from 'opds-ts/v2';

Basic usage

This is an example on how to create a simple v1.2 feed:

import { Feed, Entry } from 'opds-ts/v1.2';

const baseUrl = 'https://example.com';

const feed = new Feed('books', 'All Books')
    .setLang('en')
    .setAuthor('The Library of Babel')
    .setKind('navigation')
    .addNavigationLink('start', '/opds');

const entry = new Entry('book:1', 'The Lord of the Rings')
    .setAuthor('J. R. R. Tolkien')
    .setSummary(
        'A ring with mysterious powers lands in the hands of a young hobbit, Frodo. Under the guidance of Gandalf, a wizard, he and his three friends set out on a journey and land in the Elvish kingdom.'
    )
    .addAcquisition(
        '/entry/1/acquisition',
        'application/epub+zip',
        'open-access'
    )
    .addImage('/data/covers/1.jpg');

feed.addEntry(entry);

const xml = feed.toXml({ baseUrl, prettyPrint: true });
console.log(xml);

This is an example on how to parse a v1.2 feed:

import { Feed } from 'opds-ts/v1.2';

const xmlString = '...';
const feed = Feed.fromXml(xmlString);
console.log(feed.getEntries());

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

opds

FAQs

Package last updated on 19 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts