How can I call "stop()" at HTML?
It's inside of downloadFile2().
js example
function download() {
var req = request({
method: 'GET',
uri: url
});
var out = fs.createWriteStream(path);
req.pipe(out);
function stop(){
req.pause();
}
req.on('response', function(data) {
});
req.on('data', function(chunk) {
stop();//I want to execute this method at html .
});
}
html
<tr><td><a class="checkBtn" onclick="downloadFile2(event)">download</a></td><td><a class="checkBtn" onclick="downloadFile2.innerfunc();" value="ACTION">stop~!!!</a></td></tr>
You can make use
events
, Callstop
function fromHTML
.But make sure
download
function gets called beforestop
function.you can call function inside of another by this
Then call the child function by this