Skip to content
This repository was archived by the owner on Feb 3, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions htmltidy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function TidyWorker(opts) {
this._worker.stderr.on('data', function (data) {
errors+= data;
});
this._worker.on('exit', function (code) {
this._worker.on('close', function (code) {
switch(code){
// If there were any warnings or errors from Tiny command
case TIDY_WARN:
Expand Down Expand Up @@ -118,16 +118,16 @@ function tidy(text, opts, cb) {
throw new Error('no callback provided for tidy');

var worker = new TidyWorker(opts);
var result = '';
var result = new Array();
var error = '';
worker.on('data', function (data) {
result+= data;
result.push(data);
});
worker.on('error', function (data) {
error+= data;
});
worker.on('end', function (code) {
cb(error, result);
cb(error, Buffer.concat(result).toString());
});
worker.end(text);
}
Expand Down