Skip to content

RamyElkest/libvirt-node

Repository files navigation

Libvirt bindings for NodeJS

Build Status Dependency Status npm version

Node bindings for Libvirt

The bindings are generated from libvirt's exported api

Stability

Experimental. This library is still under active development and subject to non-backwards compatible changes in any future version. Use of this library is not recommended in production environments until version 1.0.0 is released.

Pre-requisites

  • libvirt-dev must be installed and in your include path
  • Node version that supports napi >= 8
  • gcc installed

Installation (linux)

Install libvirt-node through npm

sudo apt-get install libvirt-dev
npm install libvirt-node

Usage

const libvirt = require('libvirt-node');

let connection = libvirt.open('qemu:///system');
let domains = connection.listAllDomains(libvirt.VIR_CONNECT_LIST_DOMAINS_RUNNING);
console.log(`My running domains: ${domains.map(domain => domain.getName())}`);

More examples can be found in the tests

API

libvirt-node loosly mirrors the official libvirt docs with minor corrections (mainly without the virModule prefix)

Coverage

The API is still under development and not all libvirt functions are supported.

The whitelist has the supported (and not yet supported) functions.

Development

For development documentation please refer to DEVELOPMENT.md

Build in docker container

If you already installed docker locally, you can check build by

make docker

License

libvirt-node is released under LGPL-2.1