dolphin-tool
Version:
🐬 dolphin-tool binaries and wrapper for Node.js.
31 lines • 1.13 kB
JavaScript
import DolphinToolBin from './dolphinToolBin.js';
export default {
async listFiles(options, attempt = 1) {
const output = await DolphinToolBin.run([
'extract',
'-i', options.inputFilename,
'-l',
], options);
const files = output.split(/\r?\n/)
.filter((line) => line.trim().length > 0);
// Try to detect failures, and then retry them automatically
if (files.length === 0) {
await new Promise((resolve) => {
setTimeout(resolve, Math.random() * (2 ** (attempt - 1) * 20));
});
return this.listFiles(options, attempt + 1);
}
return files;
},
async extract(options) {
await DolphinToolBin.run([
'extract',
'-i', options.inputFilename,
'-o', options.outputFolder,
...(options.partition ? ['-p', options.partition] : []),
...(options.single ? ['-s', options.single] : []),
...(options.gameOnly ? ['-g'] : []),
], options);
},
};
//# sourceMappingURL=dolphinToolExtract.js.map