
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
capture-har
Advanced tools
Fetch requests in HAR format
This module makes a request and captures it as a HAR object. Under the covers it uses request and just passes through all options. Currently only GET requests are supported although other methods will probably work. The request body might not be properly captured though.
It can now be also used in stream mode. This means that it will stream data events containing the body of the response and then at the end event, the HAR object will be accessible.
// Promise mode
const captureHar = require('capture-har');
captureHar({
url: 'http://www.google.com'
}, { withContent: false })
.then(har => {
console.log(JSON.stringify(har, null, 2));
});
// Stream mode
const CaptureHar = require('capture-har').CaptureHar;
const captureHar = new CaptureHar(require('request'));
captureHar.start({ url: 'http://www.google.com' })
.on('data', data => // data event will contain the response body as it is received)
.on('end', () => {
const har = captureHar.stop();
// har will contain the HAR object
})
The result of code this can be found in example.json.
captureHarcaptureHar(Object|String requestOptions, [ Object harOptions ]) -> Promise<Object>
requestOptionsThe options for making the request, is just passed through to request package. This can accept the url directly.
harOptionsOptional configuration for the resulting HAR object.
withContentDefaults to true. Specifies whether the response content object should contain the full body of the response.
maxContentLengthDefaults to Infinity. Limits the response body to a maximum byte size.
If the response body is larger than the specified limit, the content text won't exist and an error will be returned for this entity with the code MAX_RES_BODY_SIZE.
FAQs
Fetch requests in HAR format
The npm package capture-har receives a total of 7 weekly downloads. As such, capture-har popularity was classified as not popular.
We found that capture-har demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.