@128technology/netconfetti 中文文档教程

发布于 5年前 浏览 31 项目主页 更新于 3年前

Netconfetti Build Statusnpm (scoped)

它始终是 NetConf 的派对

Netconfetti 是 NetConf 协议的 Javascript 客户端。

Example

const netconfetti = require('@128technology/netconfetti');

// Beacuse Netconfetti is promise based, it's extremely easy to utilize it
// in a async/await fashion.
async function main() {
  const client = new netconfetti.Client();

  await client.connect({
    host: '127.0.0.1',
    username: 'admin',
    password: 'admin',
    port: 22
  });

  // The RPC method can also take a string
  const configResponse = await client.rpc('get-config');
  console.log(configResponse.data)

  // The RPC method can also take an object that will get converted into
  // XML via xml2js.Builder.
  const doThingsResponse = await client.rpc({
    'do-things': {
      $: {
        xmlns: 'http://special-namespace-here-if-required'
      },
      'param1': 'hello',
      'param2': 'goodbye'
    }
  });

  console.log(doThingsResponse.data);
}

main().then(
  () => process.exit(0),
  err => {
    console.error(err);
    process.exit(1);
  });

Netconfetti ???? Build Statusnpm (scoped)

It's always a party with NetConf

Netconfetti is a Javascript client for the NetConf protocol.

Example

const netconfetti = require('@128technology/netconfetti');

// Beacuse Netconfetti is promise based, it's extremely easy to utilize it
// in a async/await fashion.
async function main() {
  const client = new netconfetti.Client();

  await client.connect({
    host: '127.0.0.1',
    username: 'admin',
    password: 'admin',
    port: 22
  });

  // The RPC method can also take a string
  const configResponse = await client.rpc('get-config');
  console.log(configResponse.data)

  // The RPC method can also take an object that will get converted into
  // XML via xml2js.Builder.
  const doThingsResponse = await client.rpc({
    'do-things': {
      $: {
        xmlns: 'http://special-namespace-here-if-required'
      },
      'param1': 'hello',
      'param2': 'goodbye'
    }
  });

  console.log(doThingsResponse.data);
}

main().then(
  () => process.exit(0),
  err => {
    console.error(err);
    process.exit(1);
  });
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文