Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sax-wasm

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sax-wasm - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

16

lib/saxWasm.js

@@ -162,3 +162,3 @@ "use strict";

class SAXParser {
constructor(events = 0, options = { highWaterMark: 64 * 1024 }) {
constructor(events = 0, options = { highWaterMark: 32 * 1024 }) {
this.eventTrap = (event, ptr, len) => {

@@ -205,5 +205,13 @@ const uint8array = new Uint8Array(this.wasmSaxParser.memory.buffer.slice(ptr, ptr + len));

write(chunk, offset = 0) {
const { write } = this.wasmSaxParser;
if (!this.writeBuffer) {
this.writeBuffer = new Uint8Array(this.wasmSaxParser.memory.buffer, 0, this.options.highWaterMark);
const { write, memory: { buffer } } = this.wasmSaxParser;
// Allocations within the WASM process
// invalidate reference to the memory buffer.
// We check for this and create a new Uint8Array
// with the new memory buffer reference if needed.
// **NOTE** These allocations can slow down parsing
// if they become excessive. Consider adjusting the
// highWaterMark in the options up or down to find the optimal
// memory allocation to prevent too many new Uint8Array instances.
if (!this.writeBuffer || this.writeBuffer.buffer !== buffer) {
this.writeBuffer = new Uint8Array(buffer, 0, this.options.highWaterMark);
}

@@ -210,0 +218,0 @@ this.writeBuffer.set(chunk);

{
"name": "sax-wasm",
"version": "1.3.0",
"version": "1.3.1",
"repository": "https://github.com/justinwilaby/sax-wasm",

@@ -5,0 +5,0 @@ "description": "An extremely fast JSX, HTML and XML parser written in Rust compiled to WebAssembly for Node and the Web",

@@ -33,3 +33,3 @@ # SAX (Simple API for XML) for WebAssembly

// Instantiate
const options = {highWaterMark: 64 * 1024}; // 64k chunks
const options = {highWaterMark: 32 * 1024}; // 32k chunks
const parser = new SAXParser(SaxEventType.Attribute | SaxEventType.OpenTag, options);

@@ -51,3 +51,3 @@ parser.eventHandler = (event, data) => {

});
readable.on('end', parser.end);
readable.on('end', () => parser.end());
}

@@ -54,0 +54,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc