Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access file when finished download #13

Open
dungvt opened this issue Dec 9, 2016 · 0 comments
Open

Cannot access file when finished download #13

dungvt opened this issue Dec 9, 2016 · 0 comments

Comments

@dungvt
Copy link

dungvt commented Dec 9, 2016

Hi all,
I have an issue about download 7z file:
My option:

        dl.setOptions({
            threadsCount: 5,    // Default: 2, Set the total number of download threads
            method: 'GET',      // Default: GET, HTTP method
            port: 80,           // Default: 80, HTTP port
            timeout: 10000,     // Default: 5000, If no data is received, the download times out (milliseconds)
            range: '0-100',     // Default: 0-100, Control the part of file that needs to be downloaded.
        });

Handle event:

        dl.on('error', function () {
            logger.error(`Download error: ${dl.error}`);
            reject(
                {
                    error: dl.error,
                    return: null
                }
            );
        });
        dl.on('end', function () {
            logger.info(`Download done: ${local_file}`);
            resolve(`Remote: ${remote_file}. Local: ${local_file}`);
        });

Then i call start download file.
This file type is 7z, i will extract it when finished, so when resolve statement of promise, i call extractor tool. But i got an exception:

System ERROR:
The process cannot access the file because it is being used by another process.

I think downloader not yet finished at "end" event. Check my local folder, the downloaded file is corrupted.
Have you solution for this?
Thanks for reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant