Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
return
}
if (opts.help) {
self.postMessage({
event: 'EVAL_OUTPUT_CHUNK',
chunk: encode(help()),
opts,
firstChunk: true,
error: false
})
return
}
evalHttpReq = http.request(
{
method: 'POST',
path: '/eval',
mode: 'prefer-streaming',
headers: {
'Content-Type': 'text/plain',
'Content-Length': Buffer.byteLength(input)
}
},
(res) => {
const onStreamData = (chunk) => {
debug('stream data')
self.postMessage({
event: 'EVAL_OUTPUT_CHUNK',
chunk,
opts,
showLog(logpath, id, logname) {
this.setState({
currentLogName: logname,
logText: [],
});
let path = `/api/operations/showlog/${id}/${logname}`;
let options = {
path,
method: 'GET',
};
let req = http.request(options, (res) => {
this.response = res;
res.on('data', (buf) => {
this.setState({
logText: this.state.logText.concat([buf.toString()]),
});
var objDiv = document.getElementById('logContent');
objDiv.scrollTop = objDiv.scrollHeight;
});
res.on('end', () => {
this.setState({
logText: this.state.logText.concat(['--------------------------------------']),
});
var objDiv = document.getElementById('logContent');
objDiv.scrollTop = objDiv.scrollHeight;
});
});