Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fortunejs/fortune-fs
File system adapter for Fortune.
https://github.com/fortunejs/fortune-fs
Last synced: 2 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T16:09:37.000Z (6 months ago)
- Last Synced: 2024-11-07T02:42:41.777Z (3 months ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fortune File System Adapter
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/fortunejs/fortune-fs/test.yml)
[![npm Version](https://img.shields.io/npm/v/fortune-fs.svg?style=flat-square)](https://www.npmjs.com/package/fortune-fs)
[![License](https://img.shields.io/npm/l/fortune.svg?style=flat-square)](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).