Skip to content

Instantly share code, notes, and snippets.

@nullbytepl
Last active December 8, 2021 19:17
Show Gist options
  • Select an option

  • Save nullbytepl/9777f44aeb0b032bc95890f72ca21bd7 to your computer and use it in GitHub Desktop.

Select an option

Save nullbytepl/9777f44aeb0b032bc95890f72ca21bd7 to your computer and use it in GitHub Desktop.
RFC for next-gen dumpyara. Suggest features and changes
const main = [
{
id: 'Entry validator',
type: 'fence',
validator: entryValidator,
onFail: 'exit',
},
{
id: 'Extraction sub-pipeline',
type: 'subpipeline',
intermediates: 'extracted',
pipeline: extract,
},
{
id: 'Validate that we have unpackaged files at this point',
type: 'fence',
validator: unpackagedExist,
onFail: 'exit',
},
// {...}
];
const extract = [
{
id: 'Extract basic zips',
type: 'step',
execute: extractZip,
condition: api => api.input[0].endsWith('.zip'),
onSuccess: 'returnFromSubpipeline',
},
{
id: 'Fallthrough, extraction not supported',
type: 'fail',
},
];
function entryValidator(api) {
// must be one file, zip
return (api.input.length == 1 && api.input[0].endsWith('.zip'));
}
function extractZip(api) {
// from the input file to intermediate dir for the current step
return utils.extract7z(api.input[0], api.intermediates[api.currentIntermediates]);
}
function unpackagedExist(api) {
// at least 3 files must exist
return api.intermediates[api.previousIntermediates] && api.intermediates[api.previousIntermediates].length > 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment