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

@travetto/asset

Package Overview
Dependencies
Maintainers
1
Versions
310
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/asset - npm Package Compare versions

Comparing version 4.0.7 to 4.0.8

2

package.json
{
"name": "@travetto/asset",
"version": "4.0.7",
"version": "4.0.8",
"description": "Modular library for storing and retrieving binary assets",

@@ -5,0 +5,0 @@ "keywords": [

@@ -140,3 +140,2 @@ import fs from 'node:fs/promises';

static async hashUrl(url: string, byteLimit = -1): Promise<string> {
const hasher = crypto.createHash('sha256').setEncoding('hex');
const str = await fetch(url);

@@ -148,13 +147,24 @@ if (!str.ok) {

let count = 0;
const buffer: Buffer[] = [];
for await (const chunk of body) {
if (Buffer.isBuffer(chunk) || typeof chunk === 'string') {
count += chunk?.length ?? 0;
hasher.update(chunk);
if (Buffer.isBuffer(chunk)) {
buffer.push(chunk);
count += chunk.length;
} else if (typeof chunk === 'string') {
buffer.push(Buffer.from(chunk));
count += chunk.length;
}
if (count > byteLimit && byteLimit > 0) {
body.destroy();
}
}
if (count > byteLimit && byteLimit > 0) {
body.destroy();
}
}
return hasher.end().read().toString();
const hasher = crypto.createHash('sha256').setEncoding('hex');
const finalData = Buffer.concat(buffer, byteLimit <= 0 ? undefined : byteLimit);
return hasher.update(finalData).end().read().toString();
}
}
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