Registry / storage / pear-runtime-legacy-storage

pear-runtime-legacy-storage

JSON →
library1.3.1jsnpmunverified

Read-only access to app storage from the Pear platform's internal hyperdb database, now part of the legacy runtime. Version 1.3.1 provides a simple async function to retrieve stored data by app key. It is not actively developed and is intended for migration off the deprecated storage layer. Alternatives include 'pear-runtime' for the current storage API. The package has no dependencies and is ESM-only.

npm install pear-runtime-legacy-storage
INSTALL
IMPORT
SIG · PEAR-RUNTIME-LEGAC
P
pear-runtime-legacy-storage
storagejavascriptv1.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getAppStorage
import getAppStorage from 'pear-runtime-legacy-storage'
const getAppStorage = require('pear-runtime-legacy-storage')
The package is ESM-only; CommonJS require() fails with ERR_REQUIRE_ESM.
default import as any name
import storage from 'pear-runtime-legacy-storage'
import { getAppStorage } from 'pear-runtime-legacy-storage'
The module has a single default export, not a named export. Named import returns undefined.
typeof getAppStorage
const getAppStorage: (appKey: string) => Promise<object | null>
TypeScript types are not bundled; declare or use @types/pear-runtime-legacy-storage if available.

Demonstrates how to read app storage by key using the default async function.

import getAppStorage from 'pear-runtime-legacy-storage'; const storage = await getAppStorage('pear://my-app-key'); if (!storage) { console.log('Not found or failed to open DB'); } else { console.log(storage); }
Debug
Known issues
deprecatedThe entire Pear platform legacy storage is deprecated in favor of the current pear-runtime storage API.
fix
Migrate to pear-runtime and use its storage methods.
affects: >=1.0.0
breakingCalling getAppStorage with a non-string or invalid app key argument throws TypeError.
fix
Ensure the app key is a string starting with 'pear://'. Validate before calling.
affects: >=1.0.0
gotchaThe package is ESM-only. Using require() results in ERR_REQUIRE_ESM.
fix
Use import statement or dynamic import().
affects: >=1.0.0
gotchaThe module has no TypeScript type definitions; using it in TypeScript requires manual type declaration.
fix
Add a local .d.ts file: declare module 'pear-runtime-legacy-storage' { const getAppStorage: (key: string) => Promise<any>; export default getAppStorage; }
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
Using CommonJS require() to import an ESM-only package.
fix
Change to import statement: import getAppStorage from 'pear-runtime-legacy-storage'
TypeError: The "appKey" argument must be of type string.
Passing a non-string value (e.g., undefined) to getAppStorage.
fix
Ensure the argument is a valid string, e.g., 'pear://my-app-key'.
import { getAppStorage } from 'pear-runtime-legacy-storage' results in undefined.
The package only has a default export, not a named export.
fix
Use default import: import getAppStorage from 'pear-runtime-legacy-storage'
Upgrade
Version history
1.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Amazon
1
Resources