0.0.9 • Published 6 months ago

keyv-dir-store v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months 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

6 months ago

0.0.8

6 months ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago