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

@fromdeno/cache

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fromdeno/cache - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

2

package.json
{
"name": "@fromdeno/cache",
"version": "0.1.6",
"version": "0.1.7",
"description": "Simple API for Deno cache.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -40,3 +40,3 @@ // based on https://deno.land/x/cache@0.2.13

if (!home) return ".deno";
return Path.join(home, path);
return Path.resolve(home, path);
}

@@ -8,4 +8,6 @@ import { Path, sha256 } from "./deps.deno.ts";

readonly hash: string;
/** Path where the `Response` body is (or would be) cached. */
/** Path where the response body is (or would be) cached. */
readonly path: string;
/** Path where the compiled JS is (or would be) cached. */
readonly jsPath: string;
/**

@@ -23,3 +25,3 @@ * Calculates where a gives URL is (or would be) cached.

);
this.path = Path.resolve(
this.path = Path.join(
getCacheDir(),

@@ -31,5 +33,12 @@ "deps/",

);
this.jsPath = Path.join(
getCacheDir(),
"gen/",
this.url.protocol.slice(0, -1),
this.url.hostname,
this.hash + ".js",
);
}
/** Path where the `Response` `headers` are (or would be) cached. */
/** Path where the response headers are (or would be) cached. */
get metaPath(): string {

@@ -45,7 +54,6 @@ return `${this.path}.metadata.json`;

async read(options?: Deno.ReadFileOptions): Promise<Response> {
const [body, meta] = await Promise.all([
const [body, { headers }] = await Promise.all([
Deno.readFile(this.path, options),
Deno.readTextFile(this.metaPath, options).then(JSON.parse),
]);
const headers = new Headers(meta.headers);
return new Response(body, { headers });

@@ -52,0 +60,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