UNPKG

1.16 kBTypeScriptView Raw
1/**
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License.
4 */
5/**
6 * @module botbuilder-node
7 */
8/**
9 * Copyright (c) Microsoft Corporation. All rights reserved.
10 * Licensed under the MIT License.
11 */
12import { Storage, StoreItems } from 'botbuilder';
13/**
14 * :package: **botbuilder**
15 *
16 * A file based storage provider. Items will be persisted to a folder on disk.
17 *
18 * **Usage Example**
19 *
20 * ```JavaScript
21 * const { FileStorage } = require('botbuilder');
22 * const path = require('path');
23 *
24 * const storage = new FileStorage(path.join(__dirname, './state'));
25 * ```
26 */
27export declare class FileStorage implements Storage {
28 static nextTag: number;
29 private pEnsureFolder;
30 protected readonly path: string;
31 /**
32 * Creates a new FileStorage instance.
33 * @param path Root filesystem path for where the provider should store its items.
34 */
35 constructor(filePath: string);
36 read(keys: string[]): Promise<StoreItems>;
37 write(changes: StoreItems): Promise<void>;
38 delete(keys: string[]): Promise<void>;
39 private ensureFolder;
40 private getFileName;
41 private getFilePath;
42}