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

key-file-storage

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

key-file-storage - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

index.js

0

dist/index.d.ts
export default function keyFileStorage(kfsPath: string, cacheConfig?: number | boolean): any;

@@ -0,0 +0,0 @@ "use strict";

export default function createCache(cacheConfig?: number | boolean): {};

@@ -0,0 +0,0 @@ "use strict";

2

dist/src/key-file-basic.d.ts

@@ -15,3 +15,3 @@ export default function keyFileBasic(kfsPath: string, cache: {

querySync: (collection: string) => any;
queryAsync: (collection: string) => Promise<unknown>;
queryAsync: (collection: string) => Promise<any>;
};

@@ -194,4 +194,6 @@ "use strict";

function querySync(collection) {
collection = path_1.join(kfsPath, validizeKey(collection));
if (collection in cache)
return cache[collection];
try {
collection = path_1.join(kfsPath, validizeKey(collection));
var files = recurFs.readdir.sync(collection, function (resource, status) {

@@ -201,3 +203,3 @@ return status.isFile();

files = files.map(function (file) { return path_1.relative(kfsPath, file); });
return files || [];
return (cache[collection] = files || []);
}

@@ -209,4 +211,6 @@ catch (err) {

function queryAsync(collection) {
collection = path_1.join(kfsPath, validizeKey(collection));
if (collection in cache)
return Promise.resolve(cache[collection]);
return new Promise(function (resolve, reject) {
collection = path_1.join(kfsPath, validizeKey(collection));
//// This implementation does not work with empty folders:

@@ -227,3 +231,3 @@ // recurFs.readdir(collection, function(resource, status, next) {

if (err.code === 'ENOENT')
resolve([]);
resolve((cache[collection] = []));
else

@@ -249,3 +253,3 @@ reject(err);

if (!jobNumber) {
resolve(fileList);
resolve((cache[collection] = fileList));
}

@@ -272,3 +276,3 @@ files.forEach(function (file) {

if (!jobNumber) {
resolve(fileList);
resolve((cache[collection] = fileList));
}

@@ -275,0 +279,0 @@ });

export default function createKfs(kfsPath: string, cache: {
[x: string]: any;
}): any;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import createCache from './src/create-cache';

{
"name": "key-file-storage",
"version": "2.2.1",
"version": "2.2.2",
"description": "Simple key-value storage directly on file system, maps each key to a separate file.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -0,0 +0,0 @@ # key-file-storage

@@ -0,0 +0,0 @@ export default function createCache(cacheConfig?: number | boolean) {

@@ -206,4 +206,5 @@ import {

function querySync(collection: string) {
collection = join(kfsPath, validizeKey(collection));
if (collection in cache) return cache[collection];
try {
collection = join(kfsPath, validizeKey(collection));
var files = recurFs.readdir.sync(collection, function(resource: any, status: { isFile: () => void }) {

@@ -213,3 +214,3 @@ return status.isFile();

files = files.map((file: string) => relative(kfsPath, file));
return files || [];
return (cache[collection] = files || []);
} catch (err) {

@@ -221,5 +222,6 @@ return [];

function queryAsync(collection: string) {
collection = join(kfsPath, validizeKey(collection));
if (collection in cache) return Promise.resolve(cache[collection]);
return new Promise(function(resolve, reject) {
collection = join(kfsPath, validizeKey(collection));
//// This implementation does not work with empty folders:

@@ -243,3 +245,3 @@ // recurFs.readdir(collection, function(resource, status, next) {

if (err) {
if (err.code === 'ENOENT') resolve([]);
if (err.code === 'ENOENT') resolve((cache[collection] = []));
else reject(err);

@@ -262,3 +264,3 @@ } else {

if (!jobNumber) {
resolve(fileList);
resolve((cache[collection] = fileList));
}

@@ -282,3 +284,3 @@ files.forEach(function(file) {

if (!jobNumber) {
resolve(fileList);
resolve((cache[collection] = fileList));
}

@@ -285,0 +287,0 @@ });

@@ -0,0 +0,0 @@ import keyFileBasic from './key-file-basic';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import keyFileStorage from '.';

@@ -0,0 +0,0 @@ {

{
"extends": ["tslint:recommended", "tslint-config-prettier"]
}

Sorry, the diff of this file is not supported yet

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