MCPcopy Create free account
hub / github.com/typicode/lowdb / constructor

Method constructor

src/adapters/node/DataFile.ts:45–58  ·  view source on GitHub ↗
(
    filename: PathLike,
    {
      parse,
      stringify,
    }: {
      parse: (str: string) => T
      stringify: (data: T) => string
    },
  )

Source from the content-addressed store, hash-verified

43 #stringify: (data: T) => string
44
45 constructor(
46 filename: PathLike,
47 {
48 parse,
49 stringify,
50 }: {
51 parse: (str: string) => T
52 stringify: (data: T) => string
53 },
54 ) {
55 this.#adapter = new TextFileSync(filename)
56 this.#parse = parse
57 this.#stringify = stringify
58 }
59
60 read(): T | null {
61 const data = this.#adapter.read()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected