Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flexmonster-compressor

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexmonster-compressor

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 component.

  • 2.7.17
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Flexmonster Compressor for Node.js

Flexmonster Compressor for Node.js is a special server-side compression tool that helps you to increase data loading speed from server to Flexmonster Pivot Table & Charts.

Flexmonster Compressor can compress the data from the following sources:

  • MongoDB – driver
  • MySQL – driver
  • PostgreSQL – driver
  • JSON files/streams
  • CSV files/streams

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 works on any browser (Chrome, Firefox, Internet Explorer, Safari or Opera) across Windows, macOS, Linux, iOS or Android.

Why use Flexmonster Compressor?

  • Provide a secure connection to your database or file
  • Reduce data size after compression
  • Increase data loading speed

Installation and usage

Start by installing Flexmonster Compressor as a node module and save it as a dependency in your package.json:

npm i flexmonster-compressor --save

Connect to the database or file and compress the data. Here is an example on how to create API endpoint that returns data from MongoDB:

const compressor = require('flexmonster-compressor');
const MongoClient = require('mongodb').MongoClient;

MongoClient.connect("mongodb://demo:p123456@ds121251.mlab.com:21251/flexmonster", { useNewUrlParser: true }, (err, client) => {
    if (err) throw err;
    console.log("Connected successfully to MongoDB.");
    app.set("db", client.db("flexmonster"));
});

app.get('/mongodb', (req, res) => {
    const db = req.app.get('db');
    const result = db.collection('sample_data').find({}, { projection: { '_id': false } }).stream();
    let stream = compressor.compressJsonStream(result);
    stream.on('data', data => res.write(data));
    stream.on('end', () => res.end());
});

To get the data on the front-end, please use the following code:

<!DOCTYPE html>
<html>
<head>
    <title>Demo</title>
    <link href="https://cdn.flexmonster.com/flexmonster.min.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="https://cdn.flexmonster.com/flexmonster.js"></script>
</head>
<body>

    <div id="pivot"></div>
    <script type="text/javascript">
        new Flexmonster({
            container: "#pivot",
            componentFolder: "https://cdn.flexmonster.com/",
            report: {
                dataSource: {
                    dataSourceType: "ocsv",
                    filename: "/mongodb"
                }
            }
        })
    </script>
</body>
</html>

Examples

The sample project can be found at GitHub.

Also you can get all support from development team on Forum. Flexmonster developers react fast to the questions and provide professional assistance.

Keywords

FAQs

Package last updated on 21 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc