stl-exporter
Version:
Convert face-vertex, or polygon meshes to ascii and binary STLs
20 lines (15 loc) • 588 B
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
var TextEncoder, textEncoding;
textEncoding = require('text-encoding');
TextEncoder = textEncoding.TextEncoder;
module.exports = function(string, bufferView) {
var i, index, ref, results, stringUint8array;
stringUint8array = (new TextEncoder()).encode(string);
results = [];
for (index = i = 0, ref = bufferView.byteLength; 0 <= ref ? i < ref : i > ref; index = 0 <= ref ? ++i : --i) {
results.push(bufferView.setUint8(index, stringUint8array[index] || 0));
}
return results;
};
}).call(this);