random-access-layered-storage
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -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); |
{ | ||
"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"); |
75462
1396
4
5
+ Addedfake-indexeddb@^6.0.0
+ Addedfake-indexeddb@6.0.0(transitive)