JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21
  • Score
    100M100P100Q56641F
  • License MIT

NodeJS SDK for FusionExport. Enables exporting from FusionExport through NodeJS.

Package Exports

  • fusionexport-node-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fusionexport-node-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

FusionExport Node Client

Node.js SDK for FusionExport. Enables exporting from FusionExport through Node.js.

Installation

To install the Node.js module, simply use npm:

$ npm install fusionexport-node-client --save

Usage

To require the SDK into your project:

const FusionExport = require('fusionexport-node-client');

API Reference

You can find the complete API reference here

Example

Let’s start with a simple chart export. For exporting a single chart, save the chartConfig in a JSON file. The config should be inside an array.

const fs = require('fs');
const path = require('path');

// require fusionexport
const FusionExport = require('fusionexport-node-client');

const chartConfig = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'chart-config-file.json')).toString());
const host = '127.0.0.1';
const port = 1337;

// instantiate FusionExport
const fusion = new FusionExport({ host, port });

const exportConfig = {
  chartConfig,
};

// provide the export config
fusion.export(exportConfig);

fusion.on('exportDone', (files) => {
  // files can be read from files array
  // e.g. [{tmpPath:"", realName: ""}]
});

fusion.on('exportStateChange', (state) => {
  // called for export progress state change
});

fusion.on('error', (err) => {
  // catch error here
});