electronade-filestore-util
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

electronade-filestore-util

It's a package that provides some utilities for electronade-filestore. See electronade-filestore-util.netlify.app also.

It's an optional module for electronade-filestore so electronade-filestore should be installed before using electronade-filestore-util.

npm NPM npms.io (quality) Libraries.io dependency status for latest release Maintenance

Installation

npm install electronade-filestore-util

Interfaces

class FileStore {
  constructor(filePath: string, exposedName?: string);
  public get(id: string) => Promise<any>;
  public getIds() => Promise<string[]>;
  public save(item: object) => Promise<any>;
  public remove(id: string) => Promise<undefined>;
}

Usage

import and use FileStore class in Renderer process.

import { FileStore } from "electronade-filestore-util";

const filePath = "path/to/store/file";
const fileStore = new FileStore(filePath);

const savedItem = await fileStore
  .save({ some: "thing" });

console.log(savedItem.some); // thing

console.log(
  await fileStore
    .get(savedItem._id)
    .then(({ some }) => some)
); // thing

console.log(
  await fileStore.getIds()
); // [ ...savedItem._id ]

console.log(
  await fileStore.remove(savedItem._id)
); // undefined

Readme

Keywords

Package Sidebar

Install

npm i electronade-filestore-util

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

7.62 kB

Total Files

5

Last publish

Collaborators

  • tomsd