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

@tinyhttp/etag

Package Overview
Dependencies
Maintainers
0
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/etag - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

vite.config.ts

3

dist/index.d.ts

@@ -1,4 +0,3 @@

/// <reference types="node" />
/// <reference types="node" />
import { Stats } from 'node:fs';
export declare const eTag: (entity: string | Buffer | Stats, options?: {

@@ -5,0 +4,0 @@ weak: boolean;

@@ -6,17 +6,15 @@ import { createHash } from "node:crypto";

return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
} else {
const hash = createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
const len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
return '"' + len.toString(16) + "-" + hash + '"';
}
const hash = createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
const len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
return `"${len.toString(16)}-${hash}"`;
};
const statTag = ({ mtime, size }) => {
return '"' + mtime.getTime().toString(16) + "-" + size.toString(16) + '"';
return `"${mtime.getTime().toString(16)}-${size.toString(16)}"`;
};
const eTag = (entity, options) => {
if (entity == null)
throw new TypeError("argument entity is required");
if (entity == null) throw new TypeError("argument entity is required");
const weak = (options == null ? void 0 : options.weak) || entity instanceof Stats;
const tag = entity instanceof Stats ? statTag(entity) : entityTag(entity);
return weak ? "W/" + tag : tag;
return weak ? `W/${tag}` : tag;
};

@@ -23,0 +21,0 @@ export {

{
"name": "@tinyhttp/etag",
"version": "2.1.1",
"version": "2.1.2",
"type": "module",

@@ -30,5 +30,3 @@ "description": "entity tag module",

"license": "MIT",
"files": [
"dist"
],
"dependencies": {},
"scripts": {

@@ -35,0 +33,0 @@ "dev": "vite",

Sorry, the diff of this file is not supported yet

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