Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
har-schema
Advanced tools
The har-schema npm package provides JSON schemas for HTTP Archive (HAR) format. HAR is a common format used for logging web browser interactions with websites. The schemas provided by har-schema can be used to validate HAR files to ensure they conform to the expected structure.
Validate HAR Log
This feature allows you to validate a HAR log against the HAR schema. The code sample uses the Ajv library to compile the HAR log schema and validate a HAR log data object.
const Ajv = require('ajv');
const harSchema = require('har-schema');
const ajv = new Ajv();
const validate = ajv.compile(harSchema.log);
const data = { /* HAR log data */ };
const valid = validate(data);
if (!valid) console.log(validate.errors);
Validate HAR Entries
This feature allows you to validate individual HAR entries against the HAR schema. The code sample uses the Ajv library to compile the HAR entry schema and validate a HAR entry data object.
const Ajv = require('ajv');
const harSchema = require('har-schema');
const ajv = new Ajv();
const validate = ajv.compile(harSchema.entry);
const data = { /* HAR entry data */ };
const valid = validate(data);
if (!valid) console.log(validate.errors);
The har-validator package provides a set of schemas and validation functions for HAR files. It is similar to har-schema but includes additional validation logic and helper functions to simplify the validation process.
The jsonschema package is a general-purpose JSON schema validator. While it is not specific to HAR files, it can be used to validate any JSON data against a schema, including HAR data if the appropriate schema is provided.
The ajv package is a fast JSON schema validator. It supports JSON Schema draft-07 and can be used to validate HAR files by compiling the HAR schema and validating HAR data. It is more versatile and performant compared to har-schema.
JSON Schema for HTTP Archive (HAR).
npm install --only=production --save har-schema
Compatible with any JSON Schema validation tool.
:copyright: ahmadnassri.com · License: ISC · Github: @ahmadnassri · Twitter: @ahmadnassri
FAQs
JSON Schema for HTTP Archive (HAR)
The npm package har-schema receives a total of 9,169,673 weekly downloads. As such, har-schema popularity was classified as popular.
We found that har-schema demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.