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

random-access-layered-storage

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-access-layered-storage - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

lib/random-access-layered-storage.js

@@ -92,4 +92,7 @@ import RAS from 'random-access-storage';

if (err) {
// Handle the case where the file doesn't exist
this._size = 0; // Default to size 0 for non-existing files
this.opened = true;
this.opening = false;
return req.callback(err);
return req.callback(null, { size: 0 });
}

@@ -96,0 +99,0 @@ this._size = Math.max(this._size, stats.size);

4

package.json
{
"name": "random-access-layered-storage",
"version": "1.0.1",
"version": "1.0.2",
"description": "A flexible, layered storage solution building on the random-access-storage interface. Provides an in-memory overlay with configurable eviction, paging, and strict size enforcement options, designed for complex data management scenarios.",

@@ -24,2 +24,3 @@ "type": "module",

"b4a": "^1.6.7",
"fake-indexeddb": "^6.0.0",
"lru-cache": "^11.0.1",

@@ -29,2 +30,3 @@ "random-access-storage": "^3.0.2"

"devDependencies": {
"@zacharygriffee/random-access-idb": "^4.0.31",
"brittle": "^3.7.0",

@@ -31,0 +33,0 @@ "random-access-file": "^4.0.7",

@@ -6,5 +6,18 @@ import { test, solo } from 'brittle';

import RAF from 'random-access-file';
import RAI from "@zacharygriffee/random-access-idb";
import 'fake-indexeddb/auto';
import {promisify} from "../lib/util/promisify.js";
import {deferred} from "./utils/deferred.js";
export function makeid(length) {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
let counter = 0;
while (counter < length) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
counter += 1;
}
return result;
}
const cleanupArray = [];

@@ -42,2 +55,3 @@ function cleanup(store, fn) {

Layered: () => cleanup(new RandomAccessLayeredStorage(new RAM())),
RAI: () => cleanup(RAI("test-file" + makeid(20)), store => store.purge())
};

@@ -519,3 +533,5 @@

underlyingStorage.read(deleteOffset, deleteSize, (err, buf) => {
if (err && err.message.includes('Could not satisfy length')) {
// note: messages differ between standard RAS and RAI,
// need to correct RAI message here.
if (err && err.message.includes('Could not satisfy length') ) {
t.pass('Expected error when reading beyond the file size in the underlying storage');

@@ -522,0 +538,0 @@ t.pass("Even the assertion level");

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