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

0.1.0 • Public • Published

electronade-filestore

It's a package for electronade that provides the storing features in a file.
See electronade-filestore.netlify.app also.

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

Installation

npm install electronade-filestore

What Exposed

electronade: {
  filestore: {
    get: (
      filePath: string,
      id: string
    ) => Promise<object | undefined>;

    getIds: (
      filePath: string
    ) => Promise<string[]>;

    save: (
      filePath: string,
      item: object
    ) => Promise<object>;

    remove: (
      filePath: string,
      id: string
    ) => Promise<undefined>;
  }
}

Usage

See electronade usage for details.

const filePath = "/Users/xxx/Documents/testFilePath";

const item = await electronade.filestore
  .save(filePath, { message: "hi" });

assert.equal(
  item.message,
  "hi"
);

assert(
  await electronade.filestore
    .getIds(filePath)
    .then(ids => ids.includes(item._id))
);

assert(
  await electronade.filestore
    .get(filePath, item._id)
    .then(({ message }) => message),
  "hi"
);

await electronade.filestore
  .remove(filePath, item._id);

assert.equal(
  await electronade.filestore
    .get(filePath, item._id),
  undefined
);

Readme

Keywords

Package Sidebar

Install

npm i electronade-filestore

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

8.49 kB

Total Files

5

Last publish

Collaborators

  • tomsd