sword2osis
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published

sword2osis

Lightweight Javascript library to convert Sword modules to OSIS XML

Motivation

New to the open-source Bible community?

Read a primer at github.com/danbenn/sword2json.

Getting Started

NOTE: This package has Node dependencies, such as fs, Buffer, and stream.

To install in your project:

yarn add sword2osis

or, alternatively:

npm install sword2osis --save
const fs = require('fs');
// Import from 'dist', which is Typescript compiled to ES3 (vanilla) Javascript
const { SwordModule, ModuleIndex, NodeDatabase, VerseMetadata } = require('./index');
// Use included sample file from the repository
// File path must be relative to where you run the code
const filePath = './data/ESV2011.zip';
// Load the file into a Node.js Buffer
const contents = fs.readFileSync(filePath);
// Create an index of files relevant to the module
const fileIndex = ModuleIndex.fromNodeBuffer(contents);
// Construct a SwordModule object for accessing those files
const swordModule = new SwordModule(fileIndex);
// [optional] Load Sword module contents into a sqlite database
const jsonResult = swordModule.getVerseXML('Psa 1');

Readme

Keywords

none

Package Sidebar

Install

npm i sword2osis

Weekly Downloads

0

Version

0.1.7

License

MIT

Unpacked Size

446 kB

Total Files

33

Last publish

Collaborators

  • ttrinidad