@pextra/node-lvm
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

node-lvm

A NodeJS wrapper for LVM (logical volume manager) written in TypeScript.


Downloads npm dependents Version License

Install

With npm:

npm install @pextra/node-lvm

With bun:

bun install @pextra/node-lvm

Usage

There is one default exported object with three properties: pv, vg, and lv. Each of these properties is an object containing methods for the respective LVM command.

Each command returns an object with three properties: stdout, stderr, and data. stdout and stderr are the raw output from the command. data is the parsed JSON output from the command, if any.

Any command can be run with the verbose option, which will make LVM output more information about what it is doing. Any command can be run with the test option, which will not make any changes to the system.

Due to LVM's output format, the data property will be an empty object for all non-retrieval commands. An error will be thrown if the command fails (i.e. returns a non-zero exit code).

Example:

import lvm from '@pextra/node-lvm';

const result = await lvm.pv.Create('/dev/loop0', {verbose: true});

/*
	Formed command:
		pvcreate --yes --reportformat json --verbose /dev/loop0

	Result:
	{
		"stdout": "  Wiping signatures on new PV /dev/loop0.\n  Set up physical volume for \"/dev/loop0\" with 20480 available sectors.\n  Zeroing start of device /dev/loop0.\n  Writing physical volume data to disk "\/dev/loop0\".\n  Physical volume \"/dev/loop0\" successfully created.",
		"stderr": "",
		"data": {}
	}
*/

Please see autocompletion in your editor for a full list of available commands and options.

Support/Contact

For enterprise licensing, support, and consulting, please visit our website. Alternatively, you can contact us at enterprise@pextra.cloud.

If you have any questions, please feel free open an issue or a discussion. You can also contact us at support@pextra.cloud.

Contributions

We welcome contributions! If you find any bugs, have feature requests, or would like to contribute enhancements, please feel free to open issues or submit pull requests.

We use gts for linting and formatting.

License

node-lvm is licensed under the MIT License.

Package Sidebar

Install

npm i @pextra/node-lvm

Weekly Downloads

3

Version

0.6.1

License

MIT

Unpacked Size

51.2 kB

Total Files

36

Last publish

Collaborators

  • pextra-admin