This is a file system adapter for Fortune.js.
$ npm install fortune-fs --save
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')
} ]
})
Option | Default | |
---|---|---|
concurrentReads |
128 |
limits how many files can be read concurrently by Adapter.find() |
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
} ]
})
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.
This software is licensed under the MIT license.