macadam.js 0.0.1-202504291803-dbca060
Install from the command line:
Learn more about npm packages
$ npm install @crc-org/macadam.js@0.0.1-202504291803-dbca060
Install via package.json:
"@crc-org/macadam.js": "0.0.1-202504291803-dbca060"
About this version
An NPM library to work with macadam from Node projects
The library is published on GitHub NPM registry.
You need to indicate in .npmrc
where is located the package, and you need to authenticate with a GitHub token (classic) having read:packages
scope:
.npmrc
@crc-org:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<TOKEN>
Then you can install the package for your project:
npm i @crc-org/macadam.js@latest
import * as macadamjs from '@crc-org/macadam.js';
const macadam = new macadamjs.Macadam('my-ext');
await macadam.init();
await macadam.createVm({
name: 'my-vm',
imagePath: '/path/to/image.raw',
username: 'core',
});
const vms = await macadam.listVms({});
console.log('==> vms', vms);
const startResult = await macadam.startVm({
name: 'my-vm',
});
console.log('==> start', startResult);
const stopResult = await macadam.stopVm({
name: 'my-vm',
});
console.log('==> stop', stopResult);
const rmResult = await macadam.removeVm({
name: 'my-vm',
});
console.log('==> rm result', rmResult);
const vms0 = await macadam.listVms({});
console.log('==> vms after rm', vms0);
The type
passed to the constructor is used to differentiate images between callers. When a caller uses the my-ext
type,
the images it creates with startVm({ name: 'vm1' })
will have a real name my-ext-vm1
. This real name is only visible when executing macadam list
,
but will be transparent when calling listVms({})
: this call will display the name vm1
, and will display only the machines whose real name is prefixed by my-ext
.
Details
- macadam.js
-
crc-org
- 5 months ago
- Apache-2.0
- 22 dependencies
Assets
- macadam.js-0.0.1-202504291803-dbca060.tgz
Download activity
- Total downloads 19
- Last 30 days 0
- Last week 0
- Today 0