LogoRobo.js
Framework

LegacyFileAdapter<K, V>

Class: LegacyFileAdapter<K, V>

Legacy file adapter for backward compatibility with existing .robo/data stores.

Key characteristics:

  • Filenames are SHA256 hashes of keys (not reversible)
  • Values are gzip-compressed JSON
  • No scan capability (keys are not enumerable)
  • Fixes the has() truthiness bug from the original implementation

Use this adapter to preserve access to existing Flashcore data. For new projects, consider using a v1 adapter with deterministic key storage.

Type Parameters

Type ParameterDefault type
Kstring
Vunknown

Implements

Constructors

new LegacyFileAdapter()

new LegacyFileAdapter<K, V>(options): LegacyFileAdapter<K, V>

Parameters

ParameterType
optionsLegacyFileAdapterOptions

Returns

LegacyFileAdapter<K, V>

Properties

PropertyModifierTypeDefault valueDescription
dataDirreadonlystringundefined-
namereadonly"LegacyFileAdapter"'LegacyFileAdapter'Human-readable adapter name for logging and introspection.

Methods

clear()

clear(): Promise<boolean>

Clear all data.

Returns

Promise<boolean>

Implementation of

FlashcoreAdapter.clear


delete()

delete(key): Promise<boolean>

Delete a key. Returns true if the key existed and was deleted.

Parameters

ParameterType
keyK

Returns

Promise<boolean>

Implementation of

FlashcoreAdapter.delete


get()

get(key): Promise<V>

Get a value by key. Returns undefined if the key does not exist.

Parameters

ParameterType
keyK

Returns

Promise<V>

Implementation of

FlashcoreAdapter.get


has()

has(key): Promise<boolean>

Check if a key exists.

FIXED: Unlike the original implementation which used !!get(), this properly checks file existence to handle falsy stored values.

Parameters

ParameterType
keyK

Returns

Promise<boolean>

Implementation of

FlashcoreAdapter.has


init()

init(): Promise<void>

Initialize the adapter (e.g., connect, create directories). Called once during Flashcore.$.init().

Returns

Promise<void>

Implementation of

FlashcoreAdapter.init


set()

set(key, value): Promise<boolean>

Set a key-value pair. Returns true if the operation succeeded.

Parameters

ParameterType
keyK
valueV

Returns

Promise<boolean>

Implementation of

FlashcoreAdapter.set

On this page