@unikvs/null
Usage of Null in @unikvs/null, a test storage that discards writes.
Overview
@unikvs/null Usage of Null in @unikvs/null, a test storage that discards writes.
nameisNull.isOpenis alwaystrue.- No
openorclose.
Install with:
npm install @unikvs/nullpnpm add @unikvs/nullyarn add @unikvs/nullbun add @unikvs/nullnub add @unikvs/nullaube add @unikvs/nullUsage
Null implements IStorage. Pass it to UniKvs with persist().
import { Null } from "@unikvs/null";
The following example confirms writes are discarded.
import { Null } from "@unikvs/null";
import * as unikvs from "unikvs";
const kvs = new unikvs.Builder<{
greeting: unikvs.PlainValue<string>;
}>()
.persist(new Null())
.build();
await kvs.open();
await kvs.set("greeting", "hello");
console.log(await kvs.has("greeting")); // false
await kvs.close();
Data types
| Operation | Supported data type |
|---|---|
write / read |
Arbitrary values (never stored) |
getWritable / getReadable chunks |
Arbitrary values (never stored) |
- Discards every written value.
read,delete, andgetReadablealways throwKeyNotFoundError.existsalways returnsfalse.cleardoes nothing.getWritablediscards all written chunks.
Errors
This package has no package-specific errors. Failed reads throw KeyNotFoundError, the shared error from @unikvs/core.