npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-sword

v0.0.1-beta

Published

Sword Engine(Crosswire) for NodeJS (C++ Addon)

Downloads

15

Readme

Node-Sword

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');

sword.configure({

    //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) ./
6) $SWORD_PATH

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){

    console.log(modules);
    
});

sword.info('locales', function(locales){

    console.log(locales);
    
});

How to query sword modules


var sword       = require('node-sword');

try
{
    var bibleKJV       = new sword.module('KJV');

    bibleKJV.read('Genesis 1:1', {keys:false}, function(result){
    
        console.log(result);
    });

    /*
    bibleKJV.search('God', function(result){
    
        console.log(result);
    });

    bibleKJV.read('Genesis 1,2,3', function(result){
    
        console.log(result);
    });

    bibleKJV.read('Judges 1:1', {keys:true, locale:"es"}, function(result){
    
        console.log(result);
    });

    bibleKJV.read('Ex', function(result){
    
        console.log(result);
    });
    */
    
}
catch(e)
{
    console.log(e);
}

Tests

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

$ npm install
$ make test