svm.js is a Javascript library to render StarView Metafiles to canvas. Tested in Chrome and Firefox.
<script src="lib/svm.js"></script>
svm.js defines one global function:
parseSVM(ArrayBuffer | DataView [, Object outArg]) -> HTMLCanvasElement
var canvas = parseSVM(data); // ArrayBuffer or DataView
var url = parseSVM(data).toDataURL(); // ArrayBuffer or DataView
For more options see canvas.toDataURL() on MDN.
parseSVM(data) // ArrayBuffer or DataView
.toBlob(function(blob) {
var url = URL.createObjectURL(blob);
img.addEventListener('load', function() {
URL.revokeObjectURL(url);
});
img.src = url;
});
This function has less browser support. For more information see canvas.toBlob() on MDN.
var out = {};
var canvas = parseSVM(data, out);
console.log(out.bytesRead);