-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathnode-index.js
More file actions
24 lines (22 loc) · 1.14 KB
/
node-index.js
File metadata and controls
24 lines (22 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export { Packr, Encoder, addExtension, pack, encode, NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT, REUSE_BUFFER_MODE, RESET_BUFFER_MODE, RESERVE_START_SPACE } from './pack.js';
export { Unpackr, Decoder, C1, unpack, unpackMultiple, decode, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled } from './unpack.js';
export { PackrStream, UnpackrStream, PackrStream as EncoderStream, UnpackrStream as DecoderStream } from './stream.js';
export { decodeIter, encodeIter } from './iterators.js';
export const useRecords = false;
export const mapsAsObjects = true;
import { setExtractor } from './unpack.js';
import { createRequire } from 'module';
const nativeAccelerationDisabled = process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED !== undefined && process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase() === 'true';
if (!nativeAccelerationDisabled) {
let extractor;
try {
if (typeof require == 'function')
extractor = require('msgpackr-extract');
else
extractor = createRequire(import.meta.url)('msgpackr-extract');
if (extractor)
setExtractor(extractor.extractStrings);
} catch (error) {
// native module is optional
}
}