Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@avaflow/libvirt
Advanced tools
Libvirt bindings for Node.js®.
import libvirt, {
DomainBuilder,
domainDescToXml,
domainDescFromXml,
} from "@vmngr/libvirt";
const uri = process.env.LIBVIRT_URI || "qemu:///system";
const hypervisor = new libvirt.Hypervisor({ uri });
(async () => {
await hypervisor.connectOpen();
// parse xml template
const template = await domainDescFromXml("<domain>...</domain>");
// build new domain description
const domain = new DomainBuilder()
.fromTemplate(template)
.setName("test1")
.setUUID("148d0864-2354-4c27-b82c-731bdd3f320c")
.addDisk({
type: "file", device: "disk",
driver: { name: "qemu", type: "qcow2" },
source: { file: "/home/leon/test1.img" },
target: { dev: "vda", bus: "virtio" },
})
.addInterface({
type: "network",
source: { network: "default" },
mac: { address: "52:54:00:8e:c6:5f" },
model: { type: "virtio" },
})
.build();
// define and boot domain
const xml = domainDescToXml(domain);
await hypervisor.domainCreateXML(xml);
// list active domains
const activeDomains = await hypervisor.connectListAllDomains(
libvirt.ConnectListAllDomainsFlags.ACTIVE);
// log active domain names
const activeDomainNames = await Promise.all(activeDomains
.map((domain) => hypervisor.domainGetName(domain)));
console.log(activeDomainNames);
await hypervisor.connectClose();
})();
$ sudo apt install build-essential libvirt-dev
$ npm i @vmngr/libvirt
Install Homebrew and Xcode first if not already installed.
$ brew install libvirt
$ npm i @vmngr/libvirt
Any contribution is welcome! To check wether your contribution conforms our style guide run the following tasks:
$ pip install cppcheck # required once
$ git submodule update --init --recursive # required once
$ npm run lint/bindings
$ npm run lint/lib
$ npm run lint/examples
MIT License
Copyright (c) 2019 Leon Rinkel leon@rinkel.me and vmngr/libvirt contributers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Libvirt bindings for Node.js®
We found that @avaflow/libvirt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.