let lib;
try {
    lib = await import('./napi.js');
}
catch {
    // only emit warning if running in node, checking for process is not enough since some polyfills define it
    if (typeof process == 'object' &&
        typeof process.emitWarning == 'function' &&
        typeof process.versions?.node == 'string') {
        process.emitWarning('Failed to load napi bindings, falling back to wasm bindings.', undefined, 'ZSTD');
    }
    const { compress, decompress, ...rest } = await import('./wasm.js');
    lib = {
        compress: (data, level) => {
            const result = compress(data, level);
            return Buffer.from(result.buffer, result.byteOffset, result.byteLength);
        },
        decompress: (data) => {
            const result = decompress(data);
            return Buffer.from(result.buffer, result.byteOffset, result.byteLength);
        },
        Compressor: undefined,
        Decompressor: undefined,
        ...rest,
    };
}
/** ZStandard compress */
export const { compress } = lib;
/** ZStandard decompress */
export const { decompress } = lib;
/** NodeJs Transform stream Compressor */
export const { Compressor } = lib;
/** NodeJs Transform stream Decompressor */
export const { Decompressor } = lib;
/** The type of the current module. */
export const TYPE = lib.TYPE;
/** The version of the zstd library. */
export const { ZSTD_VERSION } = lib;
export default null;
//# sourceMappingURL=index.js.map