boggan / unrar.js

Pure javascript unrar library. salvaged from bitjs
MIT License
6 stars 3 forks source link

it seems that it cannot work. is there problem in my code? #4

Open creatxrgithub opened 5 years ago

creatxrgithub commented 5 years ago

`const unrar = require('unrar.js'); const fs = require('fs');

let unpackedFiles;

let rarFile = '/media/creatxr/DATAL/xxx.rar';

unpackedFiles = unrar.unrarSync(rarFile, { onProgress: function(data) { console.log(data); let l_nPercent = Math.round((data.currentBytesUnarchived / data.totalUncompressedBytesInArchive) * 100); console.log("Progress: ", l_nPercent, "%"); } });

unpackedFiles.forEach(function(file){ console.log(file.filename, file.fileData.length); });`

console message:

{ currentFilename: '', currentFileNumber: 0, currentBytesUnarchivedInFile: 0, currentBytesUnarchived: 0, totalUncompressedBytesInArchive: 0, totalFilesInArchive: 0 } Progress: NaN %

boggan commented 5 years ago

Hi!

which version of nodejs are you using ?? do you have any error messages ?

if you go into the test folder and run: node test.js does it run or do you get any errors ?

Cheers!

creatxrgithub commented 5 years ago

nodejs version is v10.15.2

i run the code above then get the console messages.

it has nothing else error messages.

creatxrgithub commented 4 years ago

now, i use unrar-promise. it could unar the file, it just has a problem that it throw exception if the file's name include space.

const {unrar, list} = require('unrar-promise');

async function() { await unrar(f, output); }