
npm package · 2021
Pinatastore
An npm package that stores JSON on IPFS in collections and documents, like Firebase.
IPFSWeb3npm
Pinatastore is an npm package that stores JSON on IPFS, through Pinata, the way you would in Firebase: in collections and documents. Pinata’s API is built for uploading files. To store a JSON object you had to turn it into a file, upload it, keep the hash, then fetch and parse it later. Pinatastore does that part for you. I made it to learn, and because I was bored.
How it works
import { Pinatastore } from 'pinatastore';
const db = new Pinatastore(API_KEY, API_SECRET);
// Add a document with an auto-generated ID
db.add('users', { name: 'John', age: 34 });
// Create a document by name, or overwrite it
db.set('cities', 'london', { population: '8.982 million' });
// Read one document, or a whole collection
db.getDoc('cities', 'london');
db.getCollection('users'); Where it is now
It’s for small, simple data. Nothing is encrypted, and anything on IPFS is public. There’s a small demo.