10 examples of 'javascript startdownload' in JavaScript

Every line of 'javascript startdownload' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
63function startDownload( data ) {
64 incomingFileInfo = JSON.parse( data.toString() );
65 incomingFileData = [];
66 bytesReceived = 0;
67 downloadInProgress = true;
68 log( 'incoming file <b>' + incomingFileInfo.fileName + '</b> of ' + incomingFileInfo.fileSize + ' bytes' );
69}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

40function startDownload(path, fileName) {
41 var anchor = $("#DownloadAnchor");
42 anchor.attr("target", "_self");
43 anchor.attr("href", path);
44 anchor.attr("download", fileName);
45 anchor[0].click();
46};
7function startDownload() {
8 var queryMap = new Map(location.search.substr(1).split('&').map(function(a){return a.split('=')}));
9 var downloadLink = document.getElementById('downloadLink');
10
11 var number = queryMap.get('d').split('');
12 var dividend;
13 var output = '';
14 var digitsi = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_';
15 var digitso = '0123456789.ABCDEFG$';
16 var i;
17
18// alert(number + ' ' + typeof(number[0]));
19
20 while (number.join('') != digitsi[0].repeat(number.length)) {
21 dividend = 0;
22 for (i = 0; i < number.length; i++) {
23// alert(number);
24 dividend = dividend * digitsi.length + digitsi.indexOf(number[i]);
25 number[i] = digitsi[Math.floor(dividend / digitso.length)];
26 dividend = dividend % digitso.length;
27 }
28 output += digitso[dividend];
29// alert('Quotient:' + number.join('') + ', Remainder:' + dividend + ', Digit:' + digitso[dividend]);
30 }
31// alert('Output' + output.split('').reverse().join(''));
32
33 if (typeof queryMap.get('x') === 'undefined' || typeof queryMap.get('y') === 'undefined')
34 downloadLink.href = `data:image/rle,x = ${queryMap.get('w')}, y = ${queryMap.get('h')}, rule = Varlife%0A${output.split('').reverse().join('')}`;
35 else
36 downloadLink.href = `data:image/rle,%23CXRLE Pos=${queryMap.get('x')},${queryMap.get('y')}%0A` +
37 `x = ${queryMap.get('w')}, y = ${queryMap.get('h')}, rule = Varlife%0A${output.split('').reverse().join('')}`;
38 downloadLink.click();
39 history.back();
40 }
120function download(url) {
121 torrents[url] = true;
122 // If the torrent already exists, kick off the downloads of the files, as this
123 // won't happen naturally when the torrent is added (because it already exists!)
124 if(btapp.has('torrent')) {
125 if(btapp.get('torrent').each(function(torrent) {
126 if(torrent.has('properties')) {
127 if(torrent.get('properties').get('download_url') === url) {
128 download_torrent_files(torrent.get('properties'));
129 return;
130 }
131 }
132 }));
133 }
134}
89function doDownload(){
90 // get object
91 var bucketName = document.getElementById('bucket4download');
92 var objectKey = document.getElementById('key4download');
93 var saveByType = document.getElementById('saveAsByType').value;
94 getObsClient().getObject({
95 Bucket : bucketName.value,
96 Key : objectKey.value,
97 SaveByType : saveByType,
98 }).then(function(result){
99 if(saveByType === 'file'){
100 // download file path
101 console.log(result.InterfaceResult.Content.SignedUrl);
102 }else{
103 console.log(result.InterfaceResult.Content);
104 }
105 }).catch(function(err){
106 console.error(err);
107 });
108}
17function download() {
18
19 /**
20 *
21 * Function to create and send an asynchronous GET request to downloadquestions.php to get a
22 * selection of questions based on the filter buttons
23 *
24 * @author Oli Radlett <o.radlett@gmail.com>
25 *
26 */
27
28 // Get the String value of the filter button (in lower case)
29 let select = document.getElementById("select");
30 let type = select.options[select.selectedIndex].text.toLowerCase();
31
32 // Create a new XMLHttpRequest object
33 httpRequest = new XMLHttpRequest();
34 // Create the request URL based on the filter button calculated above
35 url = "downloadquestions.php?type=" + type;
36
37 // Check for errors with the XMLHttpRequest object
38 if (!httpRequest) {
39
40 console.log("Error: could not create XMLHttpRequest object");
41 return false;
42
43 }
44
45 // Set the async callback function to output
46 httpRequest.onreadystatechange = output;
47
48 // Send the request
49 httpRequest.open("GET", url);
50 httpRequest.send();
51
52}
722function onDownload(link) {
723
724 $("#downloadForRealz").html("Download " + $(link).text());
725 $("#downloadForRealz").attr('href', urlRoot + $(link).text());
726
727 $("#tos").fadeIn('fast');
728 $("#landing").fadeOut('fast');
729
730 return true;
731}
101function startDownloadRequest(url, responseType, onSuccess, onFailure) {
102 var req = new XMLHttpRequest();
103 req.open("get", url);
104 // Must set the onreadystatechange handler before calling send().
105 req.onreadystatechange = function () {
106 if (req.readyState === 4/*RequestState.DONE*/) {
107 req.onreadystatechange = null;
108 if (200 <= req.status && req.status < 300) {
109 if (onSuccess) {
110 onSuccess(req);
111 }
112 } else {
113 if (onFailure) {
114 onFailure(req);
115 }
116 }
117 }
118 };
119 if (responseType) {
120 req.responseType = responseType;
121 }
122 req.send();
123 return {
124 cancel: function () {
125 req.onreadystatechange = null;
126 req.abort();
127 }
128 };
129}
246function requestDownload(lnk, process)
247{
248 process = process || processDownload;
249
250 var xmlHttp = new XMLHttpRequest();
251 xmlHttp.open("GET", server+"?getLink('"+lnk+"')");
252 xmlHttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
253 xmlHttp.addEventListener("load", function()
254 {
255 process(JSON.parse(this.responseText));
256 });
257 xmlHttp.send();
258}
7export function download(url) {
8 const iframe = document.createElement("iframe");
9 iframe.src = url;
10 iframe.style.display = "none";
11 document.body.appendChild(iframe);
12}

Related snippets