Skip to content
Javascript (N-API) interface to SWORD library
C++ JavaScript Python CMake Shell Makefile Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
locales.d
src
.gitignore
API.md
CMakeLists.txt
COPYING
README.md
binding.gyp
build_sword.sh
deploy_local.sh
get_sword_win32.bat
index.js
package.json
sword_globconf.patch
sword_icu.patch

README.md

node-sword-interface

node-sword-interface is a nodejs module that wraps the SWORD library which gives access to bible text modules and related ressources. It has been created for use within the Ezra Project bible study software, but it can also be used for any other nodejs-based software that needs to interface with the SWORD library. The focus of node-sword-interface is on bible modules. Other types of SWORD modules are currently not supported. node-sword-interface works on Linux, macOS and Windows.

Features

node-sword-interface focusses on discovery, installation/removal and text loading of SWORD modules. It currently covers the following usecases:

  • Update SWORD repository configuration
  • List SWORD repositories
  • List remote bible modules
  • List local bible modules
  • Install a bible module
  • Uninstall a bible module
  • Get information about a bible module
  • Get the text of a bible book
  • Get the text of the whole bible
  • Search within a bible module
  • Retrieve info based on Strong's number

Example

const NodeSwordInterface = require('node-sword-interface');
var interface = new NodeSwordInterface();

interface.updateRepositoryConfig();

// Install the King James Version
interface.installModule('KJV');

// Print some module information
var kjv = interface.getLocalModule('KJV');
console.log(kjv.description);
console.log(kjv.about);

// Get the verses of the Gospel of Matthew
var verses = interface.getBookText('KJV', 'Mat');

// Do something with the verses
for (var i = 0; i < verses.length; i++) {
    var currentVerse = verses[i];
    var verseReference = currentVerse.chapter + ':' + currentVerse.verseNr;
    console.log(verseReference + ' '  + currentVerse.content);
}

API Docs

The Javascript API of node-sword-interface is documented here.

Installation

Before installing node-sword-interface you need to make sure that the following dependencies are installed:

  • C++11 compiler toolchain
  • nodejs
  • Git
  • Mac/Linux dependencies:
    • ICU library with development headers
    • CURL library with development headers
    • CMake (for building the SWORD library)

Below you find the OS-specific instructions for installing the dependencies.

Install dependencies on Linux

These installation instructions are working on Debian/Ubuntu based Linux distributions.

To install the dependencies issue the following command on a Debian/Ubuntu based distribution:

sudo apt-get install build-essential nodejs npm libcurl4-gnutls-dev libicu-dev pkg-config cmake

Install dependencies on macOS

  1. Install XCode from the App Store
  2. Install Command Line Developer Tools (contains Compiler toolchain, git, etc.) by running this command:
    xcode-select --install
  3. Install the homebrew package manager by running this command:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  4. Install some packages with homebrew by running this command:
    brew install pkg-config cmake npm

Install dependencies on Windows

  1. Install git and nodejs.
  2. Install windows-build-tools (VS 2015 Compiler) by running the following command in an administrator powershell:
    npm install --vs2015 --global windows-build-tools.

Install from npmjs

Once the dependencies are available you can install and build the latest node-sword-interface release from npmjs.com by issuing the following command:

npm install node-sword-interface

On Windows, you need to add --arch=ia32 at the end of the command:

npm install node-sword-interface --arch=ia32
You can’t perform that action at this time.