Compatibility: Only available on Node.js.
Overview
TheLocalFileStore is a wrapper around the fs module for storing data as key-value pairs.
Each key value pair has its own file nested inside the directory passed to the .fromPath method.
The file name is the key and inside contains the value of the key.
The path passed to the
.fromPath must be a directory, not a file.This file store can alter any text file in the provided directory and any subfolders.Make sure that the path you specify when initializing the store is free of other files.
Integration details
| Class | Package | Local | PY support | Downloads | Version |
|---|---|---|---|---|---|
| LocalFileStore | langchain | ✅ | ✅ |
Setup
Installation
The LangChainLocalFileStore integration lives in the langchain package:
Instantiation
Now we can instantiate our byte store:Uint8Array and back:
Usage
You can set data under keys like this using themset method:
mdelete method:
Yielding values
If you want to get back all the keys you can call theyieldKeys method. Optionally, you can pass a key prefix to only get back keys which match that prefix.
API reference
For detailed documentation of all LocalFileStore features and configurations, head to the API referenceConnect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.