downloadCompressed
Version 1.3.0.0 or later
-
Explanation
Starts the compress-download.
If you set the server path to compress the file using the setCompressURL method, the virtual files to be downloaded are compressed into a single file and downloaded.
Unlike single/multiple-file(s)-download, compresse-download is not affected by the properties (downUrl or url) that specify the download path to the target file, because they direct the compression process to the server.
var dx = dx5.get("component-id"); // The downUrl property is unnecessary for the compressed download target. // You must specify the value of the vindex property to distinguish the compression target on the server that needs compression. // vindex is a unique string value, which is the only way to distinguish between virtual files. dx.addVirtualFile({ vindex: "IDX0003", name: "bridge_509147.jpg", size: 509147 }); dx.addVirtualFile({ vindex: "IDX0004", name: "beach_239826.jpg", size: 239826 }); dx.addVirtualFile({ vindex: "IDX0005", name: "cosmos (empty) 195779.jpg", size: 195779 }); // Set the address to process the compression and return the compressed file download path dx.setCompressURL("http://domain/path/service/compress.do"); // Perform to download according to the flag value. // AUTO: Download compressed virtual files. // SELECTED: Download compressed selected virtual files. // CHECKED: Download compressed checked virtual files. dx.downloadCompressed("SELECTED");You can use the btnDownloadCompressedAuto property value at the time of component creation to use it automatically.
<button id="btn-download-compressing" type="button">Compress & Download</button> <script> dx5.create({ ..., //The compress-download function is automatically binded. btnDownloadCompressedAuto: "btn-download-compressing" }); </script>In addition to the btnDownloadCompressedAuto property, you can use btnDownloadCompressedChecked, btnDownloadCompressedSelected.
When the downloadCompressed method is called, the DEXTUploadX5 module creates a list string of comma-separated list of vindex values of items to be compressed, and submits the list string to the form data named "DEXTUploadX5_VIndexes" in POST format.
When a request is made to the server path, the server web application must compress files and return the server path where the target file can be downloaded.
While the compression is running on the server, a progress window is displayed, but when the compressed file is downloaded, it is converted to a single-file-download.
-
Uses
component.downloadCompressed(flag);
-
Parameters
Name Multi/IE Type Explanation flag Multi String "AUTO", "SELECTED", "CHECKED"
getCompressURL
Version 1.3.0.0 or later
-
Explanation
Returns the server path that handles file compression.
-
Uses
url = component.getCompressURL();
-
Return
Path to handle file compression
setCompressURL
Version 1.3.0.0 or later
-
Explanation
Sets the server path to handle file compression.
var dx = dx5.get("component-id"); // The downUrl property is unnecessary. // You must specify the value of the vindex property to distinguish targets on the server. // vindex is a unique string value, which is the only way to distinguish between virtual files. dx.addVirtualFile({ vindex: "IDX0003", name: "bridge_509147.jpg", size: 509147 }); dx.addVirtualFile({ vindex: "IDX0004", name: "beach_239826.jpg", size: 239826 }); dx.addVirtualFile({ vindex: "IDX0005", name: "cosmos (empty) 195779.jpg", size: 195779 }); // Set the address to process the compression and return the compressed file download path. dx.setCompressURL("http://domain/path./service/compress.do"); // Perform to download according to the flag value. // AUTO: Download compressed virtual files. // SELECTED: Download compressed selected virtual files. // CHECKED: Download compressed checked virtual files. dx.downloadCompressed("SELECTED");When a request is made to the server path, the server web application must compress the file and return the server path where the target file can be downloaded.
-
Uses
component.setCompressURL(url);
-
Parameters
Name Type Explanation url String Address to handle file compression
The address must be in full address format, beginning with http or https.
stopCompressWaiting
Version 1.3.0.0 or later
-
Explanation
Sends a request to stop the file compression.
DEXTUploadX5 does not have a button or GUI element that stops the compression request on the component itself.
Instead, it provides a function that can be stopped using a script.
<button type="button" onclick="stop('component-id');">중지</button> <script> function stop(id) { dx5.get(id).stopCompressWaiting(); } </script>You can use the btnStopCompressWaiting property value at the time of component creation to bind automatically.
<button id="btn-stop-compresswaiting" type="button">Stop</button> <script> dx5.create({ ..., // The stop request function is automatically binded. btnStopCompressWaiting: "btn-stop-compresswaiting" }); </script>The stopCompressWaiting method stops the compression request. After the compression process is completed, the process of downloading the file is not canceled.
-
Uses
component.stopCompressWaiting();
setLimitMultiDownloadSize
Version 1.1.0.0 or later
-
Explanation
Sets the individual limit size of the downloaded file.
Since version 1.1.0.0, we've supported multi-file downloads, but due to browser performance issues, we've placed a limit on the size of the downloaded files.
The default value is 100MB. If you want to allow more file sizes, you can change the limited size using the setLimitMultiDownloadSize function.
However, this function only changes the size of what is allowed to be downloaded, not the ability to download regardless of the browser's performance. To download files continuously using HTML5's features, you temporarily load the download target into memory, Large files, such as video files, are not good candidates for multi-file downloads. Therefore, if you need features such as large downloads and continuation, we recommend using HD applications.
// Set the download limit to 300MB. dx.setLimitMultiDownloadSize(1024 * 1024 * 300);
-
Uses
component.setLimitMultiDownloadSize(limit);
-
Parameters
Name Type Explanation limit Number Limited download size in bytes
enableResumingDownload
Version 3.8.0.0 or later
-
Explanation
Enable or disable continuation when downloading multiple files. If you are interrupted while downloading a file, the download resumes from the point where you left off. However, unlike pickup from uploads, this happens after you cancel the download or close the window, resume downloading, the download will start from the beginning.
The default is true. If your server does not accept Range requests, it is recommended to set this to false.
function onDX5Created(id) { var dx = dx5.get(id); // Disable the resume downloading. dx.enableResumingDownload(false); }As of version 3.8.0.0, the resume downloading feature is implemented to force a HEAD request to be sent to the server. Even though you disable the resuming feature, the HEAD request will still occur.
-
Uses
component.enableResumingDownload(enable);
-
Parameters
Name Type Explanation enable Boolean If true, enable the resume downloading feature. The default value is true.
pauseDownloading
Version 3.8.0.0 or later
-
Explanation
Pause a multiple file download operation.
<button type="button" onclick="pause('component-id');">Pause</button> <script> function pause(id) { dx5.get(id).pauseDownloading(); } </script>Only multiple file download operations can be paused using functions. If you are downloading a target using downloadById or the download icon, using the pauseDownloading function will not stop the operation.
-
Uses
component.pauseDownloading();
resumeDownloading
Version 3.8.0.0 or later
-
Explanation
Resumes a paused multiple file download operation.
<button type="button" onclick="resume('component-id');">Resume</button> <script> function resume(id) { dx5.get(id).resumeDownloading(); } </script>You can use the pauseDownloading method only when a download operation has been paused using the pauseDownloading method, or when it has been paused due to an error.
-
Uses
component.resumeDownloading();
setDownloadBlockSize
Version 3.8.0.0 or later
-
Explanation
Sets the download unit size for multiple file download operations.
When performing a multiple file download operation, DEXTUploadX5 divides the file by the unit size to download the file. Setting a larger download unit size reduces the number of download iterations and vice versa increases the number of download iterations. When taking over a file, the smaller the unit size, the less data is lost when the download operation is stopped.
// Limit the size of the file to be downloaded to 500 MB. dx.setLimitMultiDownloadSize(1024 * 1024 * 500); // Set the download unit size to 10 MB. dx.setDownloadBlockSize(1024 * 1024 * 10); // Start a multiple file download. dx.download("AUTO", true);- A good download unit size is 10MB, which is currently set as the default.
- Smaller unit sizes can cause memory overhead, and are only recommended on slow networks.
- The server must allow HEAD requests.
- If your server doesn't allow Range requests, you'll receive the file all at once without splitting it up.
-
Uses
component.setDownloadBlockSize(size);
-
Parameters
Name Type Explanation size Number 1KB to 1GB, default is 10MB
isUsingHDWhenSingle
Version 2.0.0.0 or later
-
Explanation
Returns whether the HD application is used for single file downloads.
-
Uses
using = component.isUsingHDWhenSingle();
-
Return
true, false
setUsingHDWhenSingle
Version 2.0.0.0 or later
-
Explanation
Enable or disable the HD application for single file downloads.
Only a single-file-download is executed when the download icon is clicked on the GUI. If you use the downloadById method, the browser-based download is performed regardless of the setting.
// Use the HD application. dx.setUsingHDWhenSingle(true);
-
Uses
component.setUsingHDWhenSingle(enable);
-
Parameters
Name Type Explanation enable Boolean If true, use the HD application. The default value is false.
getDownloadTimeInterval
Version 3.10.0.0 or later
-
Explanation
Returns a value for the time interval between file download operations.
-
Uses
interval = component.getDownloadTimeInterval();
-
Return
The time interval value in milliseconds (1/1000)
setDownloadTimeInterval
Version 3.10.0.0 or later
-
Explanation
Sets the time interval value between file download operations.
A multi-file download will result in multiple download operations, depending on the number of files and the number of chunks, each of which will be delayed by the given time value.
var dx = dx5.get("component-id"); dx.setDownloadTimeInterval(1000); -
Uses
component.setDownloadTimeInterval(interval);
-
Parameters
Name Type Explanation interval Number Time value in milliseconds (1/1000th), cannot be set below 200 ms.
isDownloadHeadRequestEnable
Version 3.10.0.0 or later
-
Explanation
Returns whether to send a HEAD request to the server for the download.
-
Uses
useHead = component.isDownloadHeadRequestEnable();
-
Return
true/false
setDownloadHeadRequestEnable
Version 3.10.0.0 or later
-
Explanation
Sets whether to send a HEAD request for download to the server.
The product sends a HEAD request in advance to get information about the file to be downloaded. If the server does not allow HEAD requests, you should set this to false.
If you don't make HEAD requests, you can't use the Continue function, and it's difficult to check for server errors when downloading a single file.
var dx = dx5.get("component-id"); dx.setDownloadHeadRequestEnable(false); -
Uses
component.setDownloadHeadRequestEnable(enable);
-
Parameters
Name Type Explanation enable Boolean The default value is true; set it to false to disable HEAD requests.
getDownloadMode
Version 4.0.0.0 or later
-
Explanation
Gets the download method.
-
Uses
mode = component.getDownloadMode();
-
Return
Either 'DEFAULT', 'AWSS3' or 'NCPOS', 'AZRBS' is returned. The default value is 'DEFAULT'.
setDownloadMode
Version 4.0.0.0 or later
-
Explanation
Sets the download method.
- DEFAULT: Used when using the default supported download method.
- AWSS3: Used when downloading files from Amazon S3. Supported in 4.0.0.0 and above.
- NCPOS: Used when downloading files from NAVER CLOUD PLATFORM Object Storage. Supported in 4.2.0.0 and above.
- AZRBS: Used when downloading files from Azure Blob Storage. Supported in 4.3.0.0 and above.
const dx = dx5.get(id); dx.setDownloadMode("AWSS3"); -
Uses
component.setDownloadMode(mode);
-
Parameters
Name Type Explanation mode String Sets one of 'DEFAULT', 'AWSS3', 'NCPOS', 'AZRBS'. The default value is 'DEFAULT'.
setAWSS3DownloadConfig
Version 4.0.0.0 or later
-
Explanation
Define settings for downloading files from Amazon S3.
dx.setDownloadMode("AWSS3"); dx.setAWSS3DownloadConfig({ type: "NON-SECRET", accessKeyId: "ABCD...1234", secretAccessKey: "ABCD...1234", region: "ap-northeast-2", bucket: "abc-bucket" }); -
Uses
component.setAWSS3DownloadConfig(config);
-
Parameters
Name Type Explanation config Object The config parameter object contains the settings for the download as properties.
Property Explanation type Set to 'NON-SECRET' for downloading directly from a browser using the AWS SDK, 'SECRET' for uploading using a Presigned URL, or omit. region Set the region, which is only valid if the type attribute is 'NON-SECRET'. bucket Sets the bucket name. Valid only if the type attribute is 'NON-SECRET'. accessKeyId Sets the access key. Valid only if the type attribute is 'NON-SECRET'. (Important security item)) secretAccessKey Sets the secret access key. Valid only if the type attribute is 'NON-SECRET'. (Important security topic) chunkSize Sets the chunk size to use when splitting the file. The default value is 10 MB and can be set from 5 MB to 100 MB. This can be set regardless of the type attribute. makeKey Sets the function to use when manually creating a key. The function has an item parameter and should return a string key value.
dx.setAWSS3DownloadConfig({ makeKey: item => { return item.name; } });signedURL Sets the address responsible for generating the Presigned URL. Valid only if the type attribute is 'SECRET' or omitted. sdkURL Sets the address where you can download the AWS SDK. The default value is 'https://sdk.amazonaws.com/js/aws-sdk-2.1037.0.min.js'.
setNCPOSDownloadConfig
Version 4.2.0.0 or later
-
Explanation
Define settings for downloading files from NAVER CLOUD PLATFORM Object Storage
dx.setDownloadMode("NCPOS"); dx.setNCPOSDownloadConfig({ type: "NON-SECRET", accessKeyId: "ABCD...1234", secretAccessKey: "ABCD...1234", // kr, us, sg, jp, de region: "kr", bucket: "abc-bucket" }); -
Uses
component.setNCPOSDownloadConfig(config);
-
Parameters
Name Type Explanation config Object The config parameter object contains the settings for the download as properties.
Property Explanation type Set to 'NON-SECRET' for downloading directly from a browser using the AWS SDK, 'SECRET' for uploading using a Presigned URL, or omit. region Set the region, which is only valid if the type attribute is 'NON-SECRET'. bucket Sets the bucket name. Valid only if the type attribute is 'NON-SECRET'. accessKeyId Sets the access key. Valid only if the type attribute is 'NON-SECRET'. (Important security item) secretAccessKey Sets the secret access key. Valid only if the type attribute is 'NON-SECRET'. (Important security topic) chunkSize Sets the chunk size to use when splitting the file. The default value is 10 MB and can be set from 5 MB to 100 MB. This can be set regardless of the type attribute. makeKey Sets the function to use when manually creating a key. The function has an item parameter and should return a string key value.
dx.setNCPOSDownloadConfig({ makeKey: item => { return item.name; } });signedURL Sets the address responsible for generating the Presigned URL. Valid only if the type attribute is 'SECRET' or omitted. sdkURL Sets the address where you can download the AWS SDK. The default value is 'https://sdk.amazonaws.com/js/aws-sdk-2.1037.0.min.js'.
setAZRBSDownloadConfig
Version 4.3.0.0 or later
-
Explanation
Define settings for downloading files from AZURE Blob Storage.
dx.setDownloadMode("AZRBS"); dx.setAZRBSDownloadConfig({ accountName: "photomanager", containerName: "photos", sasDownloadURL: "https://example.com/get-download-sastoken.ashx" }); -
Uses
component.setAZRBSDownloadConfig(config);
-
Parameters
Name Type Description config Object The config parameter object contains the settings for the download as properties.
Property Description accountName Set the Azure Blob Storage account name. containerName Set the Azure Blob Storage container name. chunkSize Set the chunk size used when splitting files. The default value is 10 MB, and you can set it from 5 MB to 100 MB. You can set it regardless of the type attribute. makeKey Set the function used when manually creating a key (key = blob name). The function must have an item parameter and return a string key value.
dx.setAZRBSUploadConfig({ makeKey: item => { return item.name; } });sasDownloadURL Set the URL for obtaining a shared access token for block downloads of blobs.