Skip to content

Commit fa62794

Browse files
committed
Return png in binary form
The png was returned as base64 encoded string. Now it's a binary.
1 parent 5dd8bb0 commit fa62794

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

lib/mj-single.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ function GetPNG(result) {
524524
width: width * pngScale,
525525
height: height * pngScale
526526
}).data;
527-
result.png = "data:image/png;base64," + (buffer || "").toString('base64');
527+
result.png = buffer || new Buffer();
528528
synch();
529529
});
530530
s.pipe(svgRenderer);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mathoid-mathjax-node",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "API's for calling MathJax from node.js",
55
"keywords": [
66
"MathJax",

test/png.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var tape = require('tape');
22
var mjAPI = require("..//lib/mj-single.js");
33
tape('basic test: check MathJax core', function(t) {
4-
t.plan(2);
4+
t.plan(1);
55

66
var tex = '\\sin(x)';
77
mjAPI.start();
@@ -10,9 +10,8 @@ tape('basic test: check MathJax core', function(t) {
1010
math: tex,
1111
format: "inline-TeX",
1212
png: true,
13-
mathoidStyle: true,
13+
mathoidStyle: true
1414
}, function (data) {
15-
t.equal(data.png.indexOf("data:image/png;base64"), 0, 'PNG has header.');
1615
t.ok(data.png.length > 100, 'PNG has a certain length');
1716
});
1817
});

0 commit comments

Comments
 (0)