0.0.9 • Published 1 year ago

keyv-dir-store v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Keyv Directory Store

High performance Filesystem Keyv Store, caches each key-value pair into a $key.json. and more! .JSON, .YAML, *.CSV is also avaliable.

Usages

// Default: Store each value with JSON in format "{value: ..., expires: ...}"
new Keyv({
  store: new KeyvDirStore(".cache/kv")
});

// Store each object list with CSV
new Keyv({
  store: new KeyvDirStore(".cache/kv", { ext: ".csv" }),
  serialize: ({ value }) => d3.csvFormat(value),
  deserialize: (str) => ({ value: d3.csvParse(str), expires: undefined }),
});

// Store each object list with TSV
new Keyv({
  store: new KeyvDirStore(".cache/kv", { ext: ".tsv" }),
  serialize: ({ value }) => d3.tsvFormat(value),
  deserialize: (str) => ({ value: d3.tsvParse(str), expires: undefined }),
});

// Store each value with YAML
new Keyv({
  store: new KeyvDirStore(".cache/kv", { ext: ".json" }),
  serialize: ({ value }) => yaml.stringify(value),
  deserialize: (str) => ({ value: yaml.parse(str), expires: undefined }),
});

// Store each value with JSON
new Keyv({
  store: new KeyvDirStore(".cache/kv", { ext: ".json" }),
  serialize: ({ value }) => JSON.stringify(value, null, 2),
  deserialize: (str) => ({ value: JSON.parse(str), expires: undefined }),
});
0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago