airkv
v0.0.2
Published
**AirKV** is a key-value database storage library built on top of Airtable. > [!CAUTION] > **Note**: This project was developed in my free time to learn more about creating npm packages. However, Airtable recently introduced a soft limit of 1000 API reque
Readme
airkv
AirKV is a key-value database storage library built on top of Airtable.
[!CAUTION] Note: This project was developed in my free time to learn more about creating npm packages. However, Airtable recently introduced a soft limit of 1000 API requests per month for free accounts, which can restrict the package’s functionality for high-demand use cases.
Version 0.0.1
Features
- Easy Storage: Store and retrieve key-value pairs in Airtable without needing direct Airtable API calls.
- Seamless Setup: Just provide your Airtable token and workspace ID.
- Automatic Record Handling: Automatically creates and updates records as needed.
Installation
Install AirKV using npm:
npm install airkvQuick Start
// const {AirKV} = require("airkv");
import {AirKV} from "airkv";
const airkv = new AirKV({
token : "..." ,
workspaceId : "...",
logging : true
});
(async()=>{
const base = await airkv.airbase("example");
await base.set("key1" , "value1");
const value = await base.get("key1");
await base.delete()
})();
Initialization
To start using AirKV, initialize it with your Airtable credentials:
import { AirKV } from 'airkv';
const airkv = new AirKV({
token: 'airtable_api_token',
workspaceId: 'workspace_id',
logging: true // optional, false by default
});Methods
airbase(name)
Creates or retrieves an Airbase instance used to store key-value pairs.
const base = await airkv.airbase('example');get(key)
Description: Retrieves the value associated with a given key.
const value = await base.get('username');
console.log(value); // value associated with 'username' or `null` if not foundset(key , value)
Description: Stores or updates a key-value pair in the base.
await base.set('username', 'shivzee');exists(key)
Description: Checks if a given key exists in the base.
const exists = await base.exists('username');
console.log(exists); // true or falsedelete(key)
Description: Deletes a key-value pair from the base.
await base.delete('username');Logging
Enable logging by setting the logging option to true when creating an AirKV instance. This will log interactions with the Airtable API for debugging purposes.
Contributing
Contributions are welcome! Submit a pull request or open an issue for any improvements or bug fixes.
Open Source Project
Author : shivzee IDE Used : VS Code Buy me a coffee
