alltomp3
alltomp3 copied to clipboard
xD make a webpack version please
xD make a webpack version please
nvm i use socket io server .. btw everything is ok only this function throws error
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: EPERM: operation not permitted, rename './mp3/temp/9e8b58518f.mp3.cover.resized.jpg' -> './mp3/temp/9e8b58518f.mp3.cover.jpg'
i really don't know how to use that "downloadAndTagSingleURL" properly ..
alltomp3.tempFolder = './mp3/temp/';
const dl = alltomp3.downloadAndTagSingleURL(url, './mp3/', undefined, undefined, false, 1);
dl.on('download', function(infos) {
process.stdout.write(infos.progress + '%\n');
});
dl.on('download-end', function() {
console.log('', 'Download end');
});
dl.on('convert', function(infos) {
process.stdout.write('Converting: ' + infos.progress + '%\n');
});
dl.on('convert-end', function() {
console.log('', 'Convert end');
});
dl.on('infos', function(infos) {
console.log('New infos received: ', infos);
});
on my temp folder theres mp3 and 2 image 9e8b58518f.mp3.cover.resized.jpg and ./mp3/temp/9e8b58518f.mp3.cover.jpg
and the script wants to rename './mp3/temp/9e8b58518f.mp3.cover.resized.jpg' -> './mp3/temp/9e8b58518f.mp3.cover.jpg'
but this is already exist ./mp3/temp/9e8b58518f.mp3.cover.jpg
i tried delete but delete not working on windows bash xD i mean unlinksync
so i rename it fs.renameSync(coverPath,coverPath + '.old'); this works but if i remove this it throws error
(node:769) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: EPERM: operation not permitted, rename './mp3/temp/9e8b58518f.mp3.cover.resized.jpg' -> './mp3/temp/9e8b58518f.mp3.cover.jpg' (node:769) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
but i really sure that renameSync will override the file if exist xD for some reason it throws error
You can just use alltomp3.downloadAndTagSingleURL(url, './mp3/')
.
For the EPERM
error, you are right, renameSync
should work and erase an existing file. The problem comes from Windows and may have two possible causes:
- If you have an antivirus, it may interfere, try to deactivate it;
- Close any program or explorer Windows using files in the
temp/
folder.
Try also to remove all files in the temp/
folder and try again.
Good luck!
I just submitted a pull request which fixes this renameSync problem. I believe this might also be the root cause of many of the problems reported when running alltomp3 on Windows.