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 install electronade-filestore-util
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>;
}
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