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

file-system-cache

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-system-cache - npm Package Compare versions

Comparing version 2.4.7 to 3.0.0

52

lib/index.d.ts

@@ -1,5 +0,47 @@

import { type t } from './common';
import { FileSystemCache } from './FileSystemCache';
declare const _default: (options?: t.FileSystemCacheOptions) => FileSystemCache;
export default _default;
export { FileSystemCache, FileSystemCache as Cache };
type HashAlgorithm = 'RSA-MD5' | 'RSA-RIPEMD160' | 'RSA-SHA1' | 'RSA-SHA1-2' | 'RSA-SHA224' | 'RSA-SHA256' | 'RSA-SHA3-224' | 'RSA-SHA3-256' | 'RSA-SHA3-384' | 'RSA-SHA3-512' | 'RSA-SHA384' | 'RSA-SHA512' | 'RSA-SHA512/224' | 'RSA-SHA512/256' | 'RSA-SM3' | 'blake2b512' | 'blake2s256' | 'id-rsassa-pkcs1-v1_5-with-sha3-224' | 'id-rsassa-pkcs1-v1_5-with-sha3-256' | 'id-rsassa-pkcs1-v1_5-with-sha3-384' | 'id-rsassa-pkcs1-v1_5-with-sha3-512' | 'md5' | 'md5-sha1' | 'md5WithRSAEncryption' | 'ripemd' | 'ripemd160' | 'ripemd160WithRSA' | 'rmd160' | 'sha1' | 'sha1WithRSAEncryption' | 'sha224' | 'sha224WithRSAEncryption' | 'sha256' | 'sha256WithRSAEncryption' | 'sha3-224' | 'sha3-256' | 'sha3-384' | 'sha3-512' | 'sha384' | 'sha384WithRSAEncryption' | 'sha512' | 'sha512-224' | 'sha512-224WithRSAEncryption' | 'sha512-256' | 'sha512-256WithRSAEncryption' | 'sha512WithRSAEncryption' | 'shake128' | 'shake256' | 'sm3' | 'sm3WithRSAEncryption' | 'ssl3-md5' | 'ssl3-sha1';
type FileSystemCacheOptions = {
basePath?: string;
ns?: any;
ttl?: number;
hash?: HashAlgorithm;
extension?: string;
};
declare class FileSystemCache {
static hashAlgorithms: HashAlgorithm[];
readonly basePath: string;
readonly ns?: any;
readonly extension?: string;
readonly hash: HashAlgorithm;
readonly ttl: number;
basePathExists?: boolean;
constructor(options?: FileSystemCacheOptions);
path(key: string): string;
fileExists(key: string): Promise<boolean>;
ensureBasePath(): Promise<void>;
get(key: string, defaultValue?: any): Promise<any>;
getSync(key: string, defaultValue?: any): any;
set(key: string, value: any, ttl?: number): Promise<{
path: string;
}>;
setSync(key: string, value: any, ttl?: number): this;
remove(key: string): Promise<void>;
clear(): Promise<void>;
save(input: ({
key: string;
value: any;
} | null | undefined)[]): Promise<{
paths: string[];
}>;
load(): Promise<{
files: {
path: string;
value: any;
}[];
}>;
}
declare const _default: (options?: FileSystemCacheOptions) => FileSystemCache;
export { FileSystemCache as Cache, FileSystemCache, _default as default };

79

package.json
{
"name": "file-system-cache",
"version": "2.4.7",
"version": "3.0.0",
"description": "A super-fast, promise-based cache that reads and writes to the file-system.",
"main": "./lib/index.js",
"scripts": {
"test": "ts-mocha -p tsconfig.json src/**/*.TEST.ts",
"build": "tsc",
"prepublish": "npm test && rm -rf ./lib && npm run build",
"gen:hashtype": "ts-node-esm -T ./script.ts/generate-hashtype.ts"
},
"dependencies": {
"@types/ramda": "0.29.3",
"@types/fs-extra": "11.0.1",
"fs-extra": "11.1.1",
"ramda": "0.29.0"
},
"devDependencies": {
"@types/chai": "4.3.5",
"@types/expect": "24.3.0",
"@types/mocha": "10.0.1",
"chai": "4.3.7",
"mocha": "10.2.0",
"ts-mocha": "10.0.0",
"ts-node": "10.9.1",
"typescript": "5.1.6"
},
"repository": {
"type": "git",
"url": "https://github.com/philcockfield/file-system-cache"
},
"resolutions": {
"json5": ">=1.0.2"
},
"keywords": [

@@ -40,2 +10,8 @@ "cache",

],
"homepage": "https://github.com/philcockfield/file-system-cache",
"repository": {
"type": "git",
"url": "https://github.com/philcockfield/file-system-cache"
},
"license": "MIT",
"author": {

@@ -46,4 +22,41 @@ "name": "Phil Cockfield",

},
"homepage": "https://github.com/philcockfield/file-system-cache",
"license": "MIT"
"type": "module",
"exports": {
".": {
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./package.json": "./package.json"
},
"main": "./lib/index.js",
"files": [
"README.md",
"lib/**"
],
"scripts": {
"build": "tsup src/index.ts --clean --minify --dts --format esm --out-dir lib --treeshake",
"format": "prettier ./src --write",
"gen:hashtype": "tsx ./script.ts/generate-hashtype.ts",
"prepublish": "npm test && npm run build",
"test": "vitest"
},
"devDependencies": {
"@types/chai": "^4.3.16",
"@types/expect": "^24.3.0",
"@types/fs-extra": "^11.0.4",
"@types/ramda": "^0.30.1",
"chai": "^5.1.1",
"fs-extra": "^11.2.0",
"prettier": "^3.3.3",
"ramda": "^0.30.1",
"tsup": "^8.1.0",
"tsx": "^4.16.2",
"typescript": "^5.5.3",
"vitest": "^2.0.3"
},
"resolutions": {
"braces": ">=3.0.3",
"vite": ">=5.3.3"
},
"packageManager": "yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71"
}

@@ -32,4 +32,4 @@ [![ci(esm)](https://github.com/philcockfield/file-system-cache/actions/workflows/node.esm.yml/badge.svg)](https://github.com/philcockfield/file-system-cache/actions/workflows/node.esm.yml)

ns: "my-namespace", // (optional) A grouping namespace for items.
hash: "sha1" // (optional) A hashing algorithm used within the cache key.
ttl: 60 // (optional) A time-to-live (in secs) on how long an item remains cached.
hash: "sha1", // (optional) A hashing algorithm used within the cache key.
ttl: 60, // (optional) A time-to-live (in secs) on how long an item remains cached.
});

@@ -36,0 +36,0 @@ ```

Sorry, the diff of this file is too big to display

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