-
Notifications
You must be signed in to change notification settings - Fork 7
/
node-index.js
29 lines (27 loc) · 1.38 KB
/
node-index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { fileURLToPath } from 'url';
import { dirname, default as path } from 'path';
import EventEmitter from 'events';
import { setExternals, setNativeFunctions } from './external.js';
import { arch } from 'os';
import fs from 'fs';
import { Encoder as MsgpackrEncoder } from 'msgpackr';
import { WeakLRUCache } from 'weak-lru-cache';
import * as orderedBinary from 'ordered-binary';
orderedBinary.enableNullTermination();
let dirName = dirname(fileURLToPath(import.meta.url)).replace(/dist$/, '');
setNativeFunctions(require('node-gyp-build')(dirName));
setExternals({
require, arch, fs, path, MsgpackrEncoder, WeakLRUCache, orderedBinary, EventEmitter
});
export { toBufferKey as keyValueToBuffer, compareKeys, compareKeys as compareKey, fromBufferKey as bufferToKeyValue } from 'ordered-binary';
export { ABORT, IF_EXISTS, asBinary } from './write.js';
export { levelup } from './level.js';
export { clearKeptObjects } from './external.js';
export { open, getLastVersion, getLastEntrySize, setLastVersion, allDbs } from './open.js';
import { toBufferKey as keyValueToBuffer, compareKeys as compareKey, fromBufferKey as bufferToKeyValue } from 'ordered-binary';
import { open, getLastVersion } from './open.js';
export default {
open, getLastVersion, compareKey, keyValueToBuffer, bufferToKeyValue, path, EventEmitter
};