When using this... for the apparent same reason you created it (.cbr files) I run into an issue that I'm not getting names: populated when creating the object.
After banging my head all through the code it seems that the names: aren't ready.
var rarfile = require('rarfile'),
cbr = new rarfile.RarFile(file, { debugMode: false });
console.log(file, cbr);
output:
/test.cbr RarFile {
archiveName: '/test.cbr',
toString: [Function],
length: [Function],
showFile: [Function],
pipe: [Function],
readFile: [Function],
readStream: [Function],
_loadNames: [Function],
rarTool: 'unrar',
debugMode: false,
viewTool: 'kview',
faultTolerant: true,
_loadedList: false,
names: [],
_events: { ready: [Function] },
_eventsCount: 1 }
If I set debugMode to true I also get a dump of the contents:
{"names":["0139 001.jpg","0139 002.jpg","0139 003.jpg","0139 004.jpg","0139 005.jpg","0139 006.jpg","0139 007.jpg","0139 008.jpg","0139 009.jpg","0139 010.jpg","0139 011.jpg","0139 012.jpg","0139 013.jpg","0139 014.jpg","0139 015.jpg","0139 016.jpg","0139 017.jpg","0139 018.jpg","0139 019.jpg","0139 020.jpg","0139 021.jpg","0139 022.jpg","0139 023.jpg","0139 024.jpg","0139 025.jpg","0139 026.jpg","0139 027.jpg","0139 028.jpg","0139 029.jpg"],"length":29}
Then I stick a console.log(who); in the on ready event and see the following:
Running << "unrar" vb "//test.cbr" >>
/test.cbr RarFile {
archiveName: '/test.cbr',
toString: [Function],
length: [Function],
showFile: [Function],
pipe: [Function],
readFile: [Function],
readStream: [Function],
_loadNames: [Function],
rarTool: 'unrar',
debugMode: true,
viewTool: 'kview',
faultTolerant: true,
_loadedList: false,
names: [],
_events: { ready: [Function] },
_eventsCount: 1 }
RarFile {
archiveName: '/test.cbr',
toString: [Function],
length: [Function],
showFile: [Function],
pipe: [Function],
readFile: [Function],
readStream: [Function],
_loadNames: [Function],
rarTool: 'unrar',
debugMode: true,
viewTool: 'kview',
faultTolerant: true,
_loadedList: true,
names:
[ '0139 001.jpg',
'0139 002.jpg',
'0139 003.jpg',
'0139 004.jpg',
'0139 005.jpg',
'0139 006.jpg',
'0139 007.jpg',
'0139 008.jpg',
'0139 009.jpg',
'0139 010.jpg',
'0139 011.jpg',
'0139 012.jpg',
'0139 013.jpg',
'0139 014.jpg',
'0139 015.jpg',
'0139 016.jpg',
'0139 017.jpg',
'0139 018.jpg',
'0139 019.jpg',
'0139 020.jpg',
'0139 021.jpg',
'0139 022.jpg',
'0139 023.jpg',
'0139 024.jpg',
'0139 025.jpg',
'0139 026.jpg',
'0139 027.jpg',
'0139 028.jpg',
'0139 029.jpg' ],
_events: { ready: [Function] },
_eventsCount: 1 }
{"names":["0139 001.jpg","0139 002.jpg","0139 003.jpg","0139 004.jpg","0139 005.jpg","0139 006.jpg","0139 007.jpg","0139 008.jpg","0139 009.jpg","0139 010.jpg","0139 011.jpg","0139 012.jpg","0139 013.jpg","0139 014.jpg","0139 015.jpg","0139 016.jpg","0139 017.jpg","0139 018.jpg","0139 019.jpg","0139 020.jpg","0139 021.jpg","0139 022.jpg","0139 023.jpg","0139 024.jpg","0139 025.jpg","0139 026.jpg","0139 027.jpg","0139 028.jpg","0139 029.jpg"],"length":29}
The first response shows nothing in names: the second from the ready event shows it populated, as does the debug info.
When using this... for the apparent same reason you created it (.cbr files) I run into an issue that I'm not getting names: populated when creating the object.
After banging my head all through the code it seems that the names: aren't ready.
output:
If I set debugMode to true I also get a dump of the contents:
Then I stick a
console.log(who);in the onreadyevent and see the following:The first response shows nothing in names: the second from the
readyevent shows it populated, as does the debug info.