No description, website, or topics provided.
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.
.vscode Major changes to ZIM Reader Feb 21, 2019
build 👷 Fixed build issues on Debian Stretch Feb 17, 2019
src 🐛 Fixed reader bug Feb 21, 2019
.env
.gitignore
.npmignore
.travis.yml 🔥 Removed extraneous files Feb 19, 2019
LICENSE
README.md
download-libzim.js
package-lock.json 📦 Update to use Libzim 4.0.5 release Feb 21, 2019
package.json 📦 Release 2.0.7 Feb 21, 2019
sources.gypi Added ZimReader Jan 13, 2019
tsconfig.json Added fullTextindexLanguage and minChunnkSize options Jan 22, 2019

README.md

node-libzim

Build Status CodeFactor

This package was built using nbind

Dependencies

On Linux, the package will download a libzim binary. On MacOS you'll need to install libzim separately (see here).

Usage

npm i libzim

Building a Zim file

// write.ts
import { ZimArticle, ZimCreator } from "libzim";

(async () => {

    console.info('Starting');
    const creator = new ZimCreator('test.zim', { welcome: 'index.html', favicon: './favicon.png' });

    for (let i = 100; i > 0; i--) {
        const a = new ZimArticle(`file${i}`, `Content ${i}`);
        await creator.addArticle(a);
    }

    const welcome = new ZimArticle(`index.html`, `<h1>Welcome!</h1>`);
    await creator.addArticle(a);

    await creator.finalise();

    console.log('Done Writing');

})();

Reading a Zim file

// read.ts

import { ZimArticle, ZimReader } from "libzim";

(async () => {

    const zimFile = new ZimReader('test.zim');

    const suggestResults = await zimFile.suggest('Content');
    console.info(`Suggest Results:`, suggestResults);

    const searchResults = await zimFile.search('Content');
    console.info(`Search Results:`, searchResults);

    const article3Content = await zimFile.getArticleByUrl('./file3');
    console.info(`Article by url (./file3):`, article3Content);

})();

License

GPLv2 - ./LICENSE