render-data
Advanced tools
Comparing version 1.1.2 to 2.0.0
22
index.js
@@ -7,2 +7,9 @@ var path = require('path') | ||
var exts = { | ||
'.csv': 'csv', | ||
'.tsv': 'csv', | ||
'.json': 'raw', | ||
'.tex': 'raw' | ||
} | ||
module.exports = { render: render, append: append } | ||
@@ -21,12 +28,13 @@ | ||
var extname = path.extname(file.name).toLowerCase() | ||
if (extname === '.csv') { | ||
var filetype = exts[path.extname(file.name).toLowerCase()] | ||
if (filetype === 'csv') { | ||
appendCSV(file, el, function (err, elem) { | ||
if (err) return handleError(file, el, cb) | ||
if (err) return cb(err) | ||
return cb(null, elem) | ||
}) | ||
} | ||
else { | ||
} else if (filetype === 'raw') { | ||
raw(file, el, cb) | ||
} else { | ||
media.append(file, el, function (err, elem) { | ||
if (err) return handleError(file, el, cb) | ||
if (err) return cb(err) | ||
return cb(null, elem) | ||
@@ -46,3 +54,3 @@ }) | ||
function handleError (file, el, cb) { | ||
function raw (file, el, cb) { | ||
var elem = document.createElement('iframe') | ||
@@ -49,0 +57,0 @@ streamToBlobURL(file.createReadStream(), function (err, url) { |
{ | ||
"name": "render-data", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"description": "Automagically render data files in the browser, like render-media", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# render-data | ||
Show a data stream in a browser. This automatically detects the extension, and displays the data intelligently, supporting video, audio, and images (thanks to [render-media](http://npmjs.com/package/render-media)). It will also attempt to display complicated filetypes intelligently, like .csv or shapefiles (coming soon). | ||
Show a data stream in a browser. This automatically detects the extension, and displays the data intelligently, supporting video, audio, and images (thanks to [render-media](http://npmjs.com/package/render-media)). | ||
It will attempt to display filetypes intelligently, like .csv and .json. | ||
### install | ||
@@ -7,0 +9,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4197
103
32