Skip to content
This repository has been archived by the owner. It is now read-only.
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

README.md

Installation

nimble install https://github.com/tim-st/nim-zim

Webserver

  • Download a ZIM file from the Kiwix page

  • In the following we use wikipedia_de_all_nopic_2018-05.zim

  • Compile the http server using Nim >= 0.19.0:

    nim c -d:release zim.nim
    
  • Change to the directory where the ZIM file exists. You will need the liblzma library installed on your system. If you're on Windows, download the file liblzma.dll from here and place it in the folder next to the zim binary.

  • Start the server (setting the port is optional and defaults to 8080)

    zim server --filename=wikipedia_de_all_nopic_2018-05.zim --port=8081
    
  • You should see

    Serving ZIM file at http://localhost:8081/kiwix.wikipedia_de_all/A/Wikipedia:Hauptseite.html
    Wikipedia
    aus Wikipedia, der freien Enzyklopädie
    2018-05-28
    Press CTRL-C to stop the server.
    
  • You can now visit the page using your webbrowser. Also just http://localhost:8081 will work and redirect you to the main page.

  • If you want to search an article you can put the search word behind /A/ like
    http://localhost:8081/kiwix.wikipedia_de_all/A/Berlin

    You will be redirected to a similiar search result.

API

Nim programmers can import zim and get information like title, url or html data from a ZimFile object:

import zim

let zf = openZimFile("wikipedia_de_all_nopic_2018-05.zim")
echo zf.getTitle
echo zf.getDescription
echo zf.getDate

for entry in zf.entriesSortedByNamespace(namespaceArticles, limit=100):
  echo entry.kind
  echo entry.title
  echo entry.url
  # let html = zf.readBlob(entry)

zf.close()

About

Reader for ZIM files written in Nim

Topics

Resources

License

Releases

No releases published

Languages

You can’t perform that action at this time.