TinyBase logoTinyBase β

getFilePath

The getFilePath method returns the location of the local file the Store is being persisted to.

getFilePath(): string
returnsstring

The location of the local file.

Example

This example creates a Persister object against a newly-created Store and then gets the file location back out again.

import {createFilePersister} from 'tinybase/persisters/persister-file';
import {createStore} from 'tinybase';

const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createFilePersister(store, '/app/persisted.json');

console.log(persister.getFilePath());
// -> '/app/persisted.json'

persister.destroy();

Since

v4.3.14