npm

open-packaging-format

0.0.11 • Public • Published

Open Packaging Format

npm version Build Status dependencies Status Coverage Status Code Climate

An simple parser for opf metadata files. This is an incomplete implementation of the OPF specification.

Install

npm install open-packaging-format;

Simple Use:

import { readOPF } from 'open-packaging-format';
 
readOPF('some/dir/to/metadata.opf')
  .then((opf) => {
    console.log(opf.title);
    console.log(opf.description);
    for (const id of opf.identifiers) {
      console.log(id);
    }
  })
  .catch(console.error);

demonstrating writing data to an OPF and then that data to a file:

import OPF, { writeOPF } from 'open-packaging-format';
 
const opf = new OPF();
opf.title = 'This is a good title';
o.writeOPF('/path/to/your.xml', opf)
  .catch(console.error);
 

Package Sidebar

Install

npm i open-packaging-format

Weekly Downloads

5

Version

0.0.11

License

ISC

Last publish

Collaborators

  • e-e-e
  • seandockray