https://github.com/fortunejs/fortune-fs
File system adapter for Fortune.
https://github.com/fortunejs/fortune-fs
Last synced: 3 months ago
JSON representation
File system adapter for Fortune.
- Host: GitHub
- URL: https://github.com/fortunejs/fortune-fs
- Owner: fortunejs
- License: mit
- Created: 2016-11-15T00:06:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T16:09:37.000Z (12 months ago)
- Last Synced: 2025-03-24T09:52:57.162Z (3 months ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fortune File System Adapter

[](https://www.npmjs.com/package/fortune-fs)
[](https://raw.githubusercontent.com/fortunejs/fortune-fs/master/LICENSE)This is a file system adapter for Fortune.js.
```sh
$ npm install fortune-fs --save
```## Usage
```js
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
```js
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](#options) to a lower value to resolve this.
## License
This software is licensed under the [MIT license](https://raw.githubusercontent.com/fortunejs/fortune-fs/master/LICENSE).