Skip to content

fortunejs/fortune-fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

af402c9 Β· May 10, 2024

History

15 Commits
Apr 30, 2024
May 10, 2024
Apr 30, 2024
Apr 30, 2024
Nov 15, 2016
May 1, 2024
Apr 30, 2024
May 9, 2024
May 10, 2024

Repository files navigation

Fortune File System Adapter

GitHub Actions Workflow Status npm Version License

This is a file system adapter for Fortune.js.

$ npm install fortune-fs --save

Usage

const path = require('path')
const fortune = require('fortune')
const fsAdapter = require('fortune-fs')

const store = fortune(recordTypes, {
  adapter: [ fsAdapter, {
    // Absolute path to database directory.
    path: path.join(__dirname, 'db')
  } ]
})

Options

Option Default
concurrentReads 128 limits how many files can be read concurrently by Adapter.find()

Options Example

const path = require('path')
const fortune = require('fortune')
const fsAdapter = require('fortune-fs')

const store = fortune(recordTypes, {
  adapter: [ fsAdapter, {
    // Absolute path to database directory.
    path: path.join(__dirname, 'db'),
    concurrentReads: 32
  } ]
})

Troubleshooting

If you have a large number of records (files), you may encounter Error: EMFILE: too many open files. Set the concurrentReads option to a lower value to resolve this.

License

This software is licensed under the MIT license.