Socket
Socket
Sign inDemoInstall

c3-exporter

Package Overview
Dependencies
83
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 1.0.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 1.0.0 (2017-4-28)
##### New Features
* **render:** Change output to Buffer ([6dc36630](https://github.com/lgaticaq/c3-exporter/commit/6dc36630fc8fe22e2b2ed42feea3cb8e3428335f))
#### 0.0.4 (2017-4-26)

@@ -2,0 +8,0 @@

2

example.js

@@ -23,2 +23,2 @@ const c3Exporter = require('c3-exporter')

await c3Exporter(options)
await c3Exporter(options) // A Buffer with content of image chart

@@ -8,2 +8,3 @@ 'use strict'

const os = require('os')
const fs = require('fs')

@@ -27,3 +28,19 @@ const render = (options, size = '320x320') => {

} else {
resolve(output)
const chunks = []
let totalLength = 0
const fileStream = fs.createReadStream(output)
fileStream.on('data', chunk => {
chunks.push(chunk)
totalLength += chunk.length
})
fileStream.on('end', () => {
fs.unlink(output, err => {
if (err) {
reject(err)
} else {
resolve(Buffer.concat(chunks, totalLength))
}
})
})
fileStream.on('error', reject)
}

@@ -30,0 +47,0 @@ })

{
"name": "c3-exporter",
"version": "0.0.4",
"version": "1.0.0",
"description": "Export c3 charts to png",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -41,5 +41,10 @@ # c3-exporter

}
const size = '320x320' // optional. Default is '320x320'
c3Exporter(options).then(chart => {
console.log(chart) // /tmp/user/chart-1954112493.png
c3Exporter(options, size).then(content => {
console.log(content) // A Buffer with content of image chart
fs.writeFile('chart.png', content, err => {
if (err) throw err
console.log('Chart saved!')
})
}).catch(console.error)

@@ -46,0 +51,0 @@ ```

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc