-
Notifications
You must be signed in to change notification settings - Fork 44
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
After download file is complete the file is "LOCKED" #17
Comments
Another issue i have noticed. this is a real issue i will need to investigate this repo source and mt-downloader spec to see this repo complies with the events of releasing the file handler. |
Hi, var fs = require('fs');
var os = require('os');
var path = require('path');
var Downloader = require('../lib/Downloader');
// Create new downloader
var downloader = new Downloader();
var fileUrl = 'http://vhost2.hansenet.de/10_mb_file.bin';
var fileSavePath = path.join(__dirname, 'mtFileDlTest1.zip');
console.log('File will be downloaded from '+ fileUrl +' to '+ fileSavePath);
// Start download
var dl = downloader.download(fileUrl, fileSavePath)
.start();
dl.on('end', function() {
fs.unlink(fileSavePath, function(err) {
if ( err ) {
console.log('ERROR: ' + err);
} else {
console.log('starting a new download on same name!');
var downloader2 = new Downloader();
var fileUrl2 = 'http://vhost2.hansenet.de/10_mb_file.bin';
var fileSavePath2 = path.join(__dirname, 'mtFileDlTest1.zip');
console.log('File will be downloaded from '+ fileUrl2 +' to '+ fileSavePath2);
// Start download
var dl2 = downloader2.download(fileUrl2, fileSavePath2)
.start();
require('./_handleEvents')(dl2);
require('./_printStats')(dl2);
}});
});
// Import generic examples for handling events and printing stats
require('./_handleEvents')(dl);
require('./_printStats')(dl); here i pasted a modified code from the example folder, it downloads a file then when it is finished it will delete it - if you follow my comments i was having issue to delete it after download assuming the file handler is still on and locking the file. In the I don't know if this is an issue of mtd-files-downloader or mt-downloader or windows just sucks. I have windows 7 64bit and node v6.60 So i assume this is a windows issue, which is the machine i do my development but thankfully it will run on linux. |
I'm having same issue, after download or stop , the file remains locked and i can't find any way to unlock the file |
When the download finishes i am unable to do files action such as move/del the downloaded file(s).
I assume somewhere when the download is finished the file handler is not released. only if i close the program that runs the downloader then i can do the specified actions.
please elaborate.
P.S thanks for this great lib!
The text was updated successfully, but these errors were encountered: