zonename

1.2.1 • Public • Published

node-zonename

Native bindings to the getzonebyid(3C) library

Usage

var zone = require('zonename');

zone.getzoneid()

Get the current zone id - direct wrapper of getzoneid(3C)

zone.getzonenamebyid(id)

Get the zone name for a given zone id - direct wrapper of getzonenamebyid(3C)

zone.getzoneidbyname(name)

Get the zone id for a given zone name - direct wrapper of getzoneidbyname(3C)

zone.getzonename()

Get the current zone name - convenience wrapper for getzonenamebyid(getzoneid())

Example

var zone = require('zonename');

zone.getzonename();
// => "global"

zone.getzoneid();
// => 0

zone.getzonenamebyid(1);
// => "39f07647-6f8a-4671-898c-104f64501ac9"

zone.getzoneidbyname("39f07647-6f8a-4671-898c-104f64501ac9");
// => 1

If a zone id or zonename is invalid or not found on the system an error will be thrown.

Benchmark

Simple benchmark to show this native module vs fork+exec of zonename(1)

$ ./benchmark/benchmark.js
zonename()        0.000098533 seconds
execFile zonename 0.032777991 seconds

License

MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.1
    2
  • 1.1.0
    1

Package Sidebar

Install

npm i zonename

Weekly Downloads

3

Version

1.2.1

License

MIT

Unpacked Size

6.25 kB

Total Files

8

Last publish

Collaborators

  • bahamat
  • todd.whiteman
  • kusor
  • michael.hicks
  • trentm
  • jclulow
  • bahamas10
  • arekinath