store for jscpd, used for large repositories
npm install @jscpd/leveldb-store --save
import {Tokenizer} from '@jscpd/tokenizer';
import {
Detector,
IOptions,
IClone,
IStore,
ITokenizer
} from '@jscpd/core';
import LeveldbStore from '@jscpd/leveldb-store';
const options: IOptions = {
minLines: 5,
maxLines: 500,
}
const tokenizer: ITokenizer = new Tokenizer();
// Default: stores cache in .jscpd/ relative to cwd
const store: IStore = new LeveldbStore();
const detector = new Detector(tokenizer, store, [], options);Pass a directory path to the constructor to override the default .jscpd/ location:
// Cache stored at /tmp/my-jscpd-cache/<namespace>
const store: IStore = new LeveldbStore('/tmp/my-jscpd-cache');Via CLI, use the --store-path option:
jscpd /path/to/source --store leveldb --store-path /tmp/my-jscpd-cacheWhen running multiple jscpd processes simultaneously, each process must use a distinct storePath to avoid LevelDB file conflicts:
jscpd /data/files/1 /data/repo/ --store leveldb --store-path /tmp/jscpd-1 --reporters json &
jscpd /data/files/2 /data/repo/ --store leveldb --store-path /tmp/jscpd-2 --reporters json &
waitMIT © Andrey Kucherenko