npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pinatastore

v0.1.4

Published

A simple module to store and retrieve simple JSON data from a decentralized databse. (Pinata IPFS) Pinatastore uses a structure similar to firebase and stores them in ipfs through Pinata. (Collections and Documents) Pinatastore is basically a wrapper on

Downloads

9

Readme

🦄 Pinatastore Hits

A simple module to store and retrieve simple JSON data from a decentralized databse. (Pinata IPFS) Pinatastore uses a structure similar to firebase and stores them in ipfs through Pinata. (Collections and Documents) Pinatastore is basically a wrapper on top of the pinata API to make it easier to work with JSON data.

Note: This project was made for educational puposes. But feel free to use it in your projects

Demo

Hosted - https://colorstore.vercel.app/

Repo - https://github.com/notnavindu/pinatastore-demo

Coming soon

  • Query by primary key

Use this if ...

  • Your data is not complex
  • Your project is not large scale
  • Your data doesn't need encryption
  • Your data can be publicly stored

Installation

npm install pinatastore

or

yarn add pinatastore

Setup

import { Pinatastore } from "pinatastore"
const db = new Pinatastore(API_KEY, API_SECRET)

You can get the API key and API secret from the Pinata dashboard.

Methods

db.add(collection, data [, primaryKeys] ➔ returns the autogenerated ID of the document

Adds data to a given collection. This will auto-generate a unique ID for the document

  • collection String
    • Name of the collection
  • data Object
    • A JS Object with data you want to store
  • primaryKeys
    • (Coming soon)

Example

db.add("users", {
    name: "John",
    age: 34
});

db.set(collection, document, data [, primaryKeys] ➔ returns the ipfs hash ID of the document

set() will create a new document or rewrite the existing document of the given ID with the provided data

  • collection String
    • Name of the collection
  • document String
    • Name of the document
  • data Object
    • A JS Object with data you want to store
  • primaryKeys
    • (Coming soon)

Example

db.set("cities", "london", {
    population: "8.982 million"
});

db.getDoc(collection, document) ➔ Returns the document data

Get data of the given document

  • collection String
    • Name of the collection
  • document String
    • Name of the document
db.getDoc("cities", "london");

// returns
// {
//  documentId: 'cities',
//  data: { population: '8.982 million' }
// }

db.getCollection(collection) ➔ Returns an array of documents

Get all the documents of a collection

  • collection String
    • Name of the collection
db.getCollection("users");

// returns
// [
//  {
//    documentId: 'c4422589-0153-43eb-926a-71e2576aa1ad',
//    data: { name: 'John', age: 34 }
//  },
//  {
//    documentId: '967b91f4-e5f4-46fc-a26c-fdb881f8ccaa',
//    data: { name: 'Anna', age: 23 }
//  }
]

db.getCollectionHashes(collection) ➔ Returns an array of ipfs hashes

Returns an array of the ipfs hashes of the documents. These can be used to retrieve data on the client side. This can be useful if you have a server with limited performance.

  • collection String
    • Name of the collection
db.getCollectionHashes("users");

// returns
// [
//   'QmNnThL8PzHBsY6uRYWgGheN2wxvfFt13uwunw8rrNvJhh',
//   'QmZ6pv1jNnmBaASYkKEXAAJG7cWu2zNrDxbf7geiHuJ9UE' 
// ]

Keep in mind that this was made entirely because I was bored so there might be bugs here and there. Please feel free to open issues or contribute to the project :)