New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hysnappy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hysnappy - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

4

hysnappy.d.ts

@@ -7,3 +7,3 @@ /**

*/
export async function snappyUncompress(input: Uint8Array, output: Uint8Array): Promise<void>
export async function snappyUncompress(input: Uint8Array, outputLength: number): Uint8Array

@@ -13,2 +13,2 @@ /**

*/
export function snappyUncompressor(): (input: Uint8Array, output: Uint8Array) => void
export function snappyUncompressor(): (input: Uint8Array, output: number) => Uint8Array

@@ -5,6 +5,7 @@ /**

* @param {Uint8Array} input
* @param {Uint8Array} output
* @param {number} outputLength
* @returns {Uint8Array}
*/
export function snappyUncompress(input, output) {
snappyUncompressor()(input, output)
export function snappyUncompress(input, outputLength) {
return snappyUncompressor()(input, outputLength)
}

@@ -15,3 +16,3 @@

*
* @returns {(input: Uint8Array, output: Uint8Array) => void}
* @returns {(input: Uint8Array, outputLength: number) => Uint8Array}
*/

@@ -22,3 +23,3 @@ export function snappyUncompressor() {

return (input, output) => {
return (input, outputLength) => {
/** @type {any} */

@@ -34,3 +35,3 @@ const { memory, uncompress } = wasm.exports

// WebAssembly memory
const totalSize = inputStart + input.byteLength + output.byteLength
const totalSize = inputStart + input.byteLength + outputLength
if (memory.buffer.byteLength < totalSize) {

@@ -59,7 +60,3 @@ // Calculate the number of pages needed, rounding up

// Get uncompressed data from WASM memory
const uncompressed = byteArray.slice(outputStart, outputStart + output.byteLength)
// Copy the uncompressed data to the output buffer
// TODO: Return WASM memory buffer instead of copying?
output.set(uncompressed)
return byteArray.slice(outputStart, outputStart + outputLength)
}

@@ -66,0 +63,0 @@ }

{
"name": "hysnappy",
"version": "0.2.0",
"version": "0.3.0",
"description": "snappy decompressor for wasm",

@@ -33,3 +33,3 @@ "keywords": [

"@babel/eslint-parser": "7.23.10",
"@types/node": "20.11.20",
"@types/node": "20.11.21",
"@vitest/coverage-v8": "1.3.1",

@@ -36,0 +36,0 @@ "eslint": "8.57.0",

@@ -22,4 +22,4 @@ # HySnappy

])
const output = new Uint8Array(10)
snappyUncompress(compressed, output)
const outputLength = 10
const output = snappyUncompress(compressed, outputLength)
```

@@ -26,0 +26,0 @@

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