Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »


0.0.1-beta • Public • Published


Node-Sword is a binding for the Sword API Engine which makes it possible to use it from your Node.js based project.

Setting up

$ npm install node-sword

Note: currently node-sword only works for Unix based systems

How to use

var sword = require('node-sword');
    //Directory containing mods.conf file or mods.d directory
    'modules'   : __dirname+'/resources',   /* default: system lookup (See note * below) */
    //Output format
    'format'    : sword.FORMAT_RTF,                 /* default: sword.FORMAT_PLAIN */
    //Directory containing locale files
    'locales'   : __dirname+'/resources/locales'    /* default: /usr/share/sword/locales.d */

The "modules" attribute defines the directory containing the mods.conf file or the mods.d folder, not the actual modules location, which can be the same or some another. This last is defined in your mods.conf file or in the mods.d folder containing all configuration files. You may have either all configurations in a single file (mods.conf) or splited into multiple files inside a mods.d folder. Set up an example tree directory as the next one at your root project (same directory where you did run npm install):

  • resources
    • mods.d // Contains the modules configuration files
    • modules // Contains the modules themselves
    • locales // Contains the locale files

As an example, let's download the KJV bible module (find more from here) and after unzip it, you'll have a folder KJV containing two folders: "mods.d" and "modules". Copy/Move the kjv.conf file inside mods.d folder into resources/mods.d/ and then copy the "texts" folder inside modules folder into resources/modules/

(*) If you do not set a "modules" key in the sword.configure, then it looks by default for modules in a configuration file in some of the following directories:

1) /etc/sword.conf
2) /usr/local/etc/sword.conf
3) $HOME/.sword/
4) $HOME/sword/
5) ./

The configuration file must contain valuable information about the location of your modules

In all cases, except for the first and second one, sword engine looks for a file with the name "mods.conf", or the files in the directory "mods.d". For instance, in the third case, it would look for: $HOME/.sword/mods.conf, $HOME/.sword/mods.d/*.conf

More information here

How to retrieve information

var sword = require('node-sword');
sword.info('modules', function(modules){
sword.info('locales', function(locales){

How to query sword modules

var sword       = require('node-sword');
    var bibleKJV       = new sword.module('KJV');
    bibleKJV.read('Genesis 1:1', {keys:false}, function(result){
    bibleKJV.search('God', function(result){
    bibleKJV.read('Genesis 1,2,3', function(result){
    bibleKJV.read('Judges 1:1', {keys:true, locale:"es"}, function(result){
    bibleKJV.read('Ex', function(result){


In order to run the tests, first install dependences and then just run "make test" or "npm test"

$ npm install
$ make test


npm i node-sword

DownloadsWeekly Downloads






Last publish


  • avatar