Extract response bodies from http archives (.har
).
const extract = require('@vegardit/har-extract');
extract({ outputDir: 'tmp', inputFile: 'my-test-file.har' }).then((result) => {
const { outputDir, harFile } = result;
console.log('response bodies are extracted to %d', outputDir);
console.log('the reduced new har file can be found at %d', harFile);
})
-
outputDir
(optional), default:output
absolute or relative path to write extracted content to. Any provided path is run through make-dir to ensure it's existence. Relative paths are coerced throughpath.resolve(outputDir)
, which will resolve an absolute path fromprocess.cwd()
. -
inputFile
(required): absolute or relative path to http archive file. File content is loaded and (ifvalidateInput
is truthy) validated through har-validator to ensure compliance with HAR 1.2 spec. Also,inputFile
must not be nested withinoutputDir
. -
validateInput
(optional), default:false
turn on / off validation ofinputFile
content through har-validator. (this currently leads to validation errors whenipv6
addresses are listed inentries[].serverIPAddress
, hence the default isfalse
)
All files are released under the Apache License 2.0.