# LocalFileStore

> **Class** in `langchain`

📖 [View in docs](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore)

File system implementation of the BaseStore using a dictionary. Used for
storing key-value pairs in the file system.

## Signature

```javascript
class LocalFileStore
```

## Extends

- `BaseStore<string, Uint8Array>`

## Constructors

- [`constructor()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/constructor)

## Properties

- `lc_kwargs`
- `lc_namespace`
- `lc_serializable`
- `rootPath`
- `lc_aliases`
- `lc_attributes`
- `lc_id`
- `lc_secrets`
- `lc_serializable_keys`

## Methods

- [`mdelete()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/mdelete)
- [`mget()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/mget)
- [`mset()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/mset)
- [`toJSON()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/toJSON)
- [`toJSONNotImplemented()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/toJSONNotImplemented)
- [`yieldKeys()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/yieldKeys)
- [`fromPath()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/fromPath)
- [`lc_name()`](https://reference.langchain.com/javascript/langchain/storage/file_system/LocalFileStore/lc_name)

## Examples

```typescript
const store = await LocalFileStore.fromPath("./messages");
await store.mset(
  Array.from({ length: 5 }).map((_, index) => [
    `message:id:${index}`,
    new TextEncoder().encode(
      JSON.stringify(
        index % 2 === 0
          ? new AIMessage("ai stuff...")
          : new HumanMessage("human stuff..."),
      ),
    ),
  ]),
);
const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
for await (const key of store.yieldKeys("message:id:")) {
  await store.mdelete([key]);
}
```

---

[View source on GitHub](https://github.com/langchain-ai/langchainjs/blob/e493ed653d734e31a8d051f78ab29b067f530e4b/libs/langchain/src/storage/file_system.ts#L35)