Giter Club home page Giter Club logo

storagestack's Introduction

StorageStack

With storagestack you can use middleware to control the flow of storing data into a storage system.

When we see the rise of decentralized applications it is important to build upon a framework to control the content in these distributed systems. This will help to implement common functionality within the space.

This provides you with the application object of storagestack

import { ss } from '@storagestack/core';

Provider

A provider is an abstract definition of a storage mechanism. Every provider can set, get and delete content.

You can register a provider on the application object of storagestack.

ss.registerProvider(new MemoryProvider());

Or when you want to use a pattern ...

ss.registerProvider(new MemoryProvider(), '*-index.json');

Take a look in the core library to the provider interface.

We have implementations for:

  • WebNative (Fission)
  • Blockstack
  • IPFS
  • Localstorage
  • Memory

Middleware

You will have also an ability to define middleware to transform your storage content to the content you want for your application.

You register a middleware by providing a pattern when the middleware needs to be handled and the middleware implementation.

ss.use('*', new UpperMiddleware());

When you want to create your own middleware you can just implement the 'MiddlewareStack' interface.

An example of a middleware implementation that has a counter and transforms the content to uppercase when it is been set.

class UpperMiddleware implements MiddlewareStack {
    count = 1;
    
    set(storageInfo: StorageInfo, next: () => void) {
        storageInfo.content = storageInfo.content.toUpperCase();
        next();
    }
    
    get(storageInfo: StorageInfo, next: () => void) {
        storageInfo.content = `${this.count} ${storageInfo.origin}`;
        this.count++;
        next();
    }
}

You can always read more in the online guide

storagestack's People

Contributors

dependabot[bot] avatar jorishermans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

storagestack's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.