Flexmonster Compressor for Node.js
Flexmonster Compressor for Node.js – a special server-side compression tool that helps you to increase data loading speed from server to (Flexmonster Pivot Table)[http://www.flexmonster.com/] component.
What is JS Pivot Table by Flexmonster?
Flexmonster Pivot Table & Charts is a component for interactive pivot reports that can be inserted to a web page or a web application. It’s a powerful JavaScript tool to visualize your business data.
Flexmonster Pivot is a cross-platform web component that seamlessly work on any browser (Chrome, Firefox, Internet Explorer, Safari or Opera) across Windows, macOS, Linux, iOS or Android.
How to use compressor?
Here is an example how to create API endpoint that returns data from MongoDB:
const compressor = require('flexmonster-compressor');
app.get('/data', (req, res) => {
let dbResult = dbo.collection("my_collection").find().stream();
let outputStream = compressor.compressJsonStream(dbResult);
outputStream.on('data', data => res.write(data));
outputStream.on('end', () => res.end());
});
Then, on the font-end, you can use this endpoint to connect Flexmonster Pivot Table as follows:
var pivot = new Flexmonster({
report: {
dataSource: {
dataSourceType: "ocsv",
filename: "http://your_api_host/data"
}
}
});