{"version":3,"file":"node.cjs","names":["BaseFileStore","fs"],"sources":["../../../src/stores/file/node.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { mkdtempSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { BaseFileStore } from \"./base.js\";\n\n/**\n * Specific implementation of the `BaseFileStore` class for Node.js.\n * Provides methods to read and write files in a specific base path.\n */\nexport class NodeFileStore extends BaseFileStore {\n  lc_namespace = [\"langchain\", \"stores\", \"file\", \"node\"];\n\n  constructor(public basePath: string = mkdtempSync(\"langchain-\")) {\n    super();\n  }\n\n  /**\n   * Reads the contents of a file at the given path.\n   * @param path Path of the file to read.\n   * @returns The contents of the file as a string.\n   */\n  async readFile(path: string): Promise<string> {\n    return await fs.readFile(join(this.basePath, path), \"utf8\");\n  }\n\n  /**\n   * Writes the given contents to a file at the specified path.\n   * @param path Path of the file to write to.\n   * @param contents Contents to write to the file.\n   * @returns Promise that resolves when the file has been written.\n   */\n  async writeFile(path: string, contents: string): Promise<void> {\n    await fs.writeFile(join(this.basePath, path), contents, \"utf8\");\n  }\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,IAAa,gBAAb,cAAmCA,aAAAA,cAAc;CAC/C,eAAe;EAAC;EAAa;EAAU;EAAQ;EAAO;CAEtD,YAAY,YAAO,GAAA,QAAA,aAA+B,aAAa,EAAE;AAC/D,SAAO;AADU,OAAA,WAAA;;;;;;;CASnB,MAAM,SAAS,MAA+B;AAC5C,SAAO,MAAMC,iBAAG,UAAA,GAAA,UAAA,MAAc,KAAK,UAAU,KAAK,EAAE,OAAO;;;;;;;;CAS7D,MAAM,UAAU,MAAc,UAAiC;AAC7D,QAAMA,iBAAG,WAAA,GAAA,UAAA,MAAe,KAAK,UAAU,KAAK,EAAE,UAAU,OAAO"}