minify-html/nodejs/lib/index.js

15 lines
340 B
JavaScript
Raw Normal View History

2020-01-04 22:10:21 -05:00
const hyperbuild = require('../native');
module.exports = {
minify: code => {
const buf = Buffer.from(code);
const len = hyperbuild.minify(buf);
return buf.slice(0, len).toString();
},
minify_in_place: buf => {
const len = hyperbuild.minify(buf);
// This does not do a copy.
return buf.slice(0, len);
},
2020-01-04 22:10:21 -05:00
};