1 |
|
2 |
|
3 |
|
4 | #include <mutex> // NOLINT(build/c++11)
|
5 |
|
6 | #include <napi.h>
|
7 | #include <vips/vips8>
|
8 |
|
9 | #include "common.h"
|
10 | #include "metadata.h"
|
11 | #include "pipeline.h"
|
12 | #include "utilities.h"
|
13 | #include "stats.h"
|
14 |
|
15 | Napi::Object init(Napi::Env env, Napi::Object exports) {
|
16 | static std::once_flag sharp_vips_init_once;
|
17 | std::call_once(sharp_vips_init_once, []() {
|
18 | vips_init("sharp");
|
19 | });
|
20 |
|
21 | g_log_set_handler("VIPS", static_cast<GLogLevelFlags>(G_LOG_LEVEL_WARNING),
|
22 | static_cast<GLogFunc>(sharp::VipsWarningCallback), nullptr);
|
23 |
|
24 |
|
25 | exports.Set("metadata", Napi::Function::New(env, metadata));
|
26 | exports.Set("pipeline", Napi::Function::New(env, pipeline));
|
27 | exports.Set("cache", Napi::Function::New(env, cache));
|
28 | exports.Set("concurrency", Napi::Function::New(env, concurrency));
|
29 | exports.Set("counters", Napi::Function::New(env, counters));
|
30 | exports.Set("simd", Napi::Function::New(env, simd));
|
31 | exports.Set("libvipsVersion", Napi::Function::New(env, libvipsVersion));
|
32 | exports.Set("format", Napi::Function::New(env, format));
|
33 | exports.Set("block", Napi::Function::New(env, block));
|
34 | exports.Set("_maxColourDistance", Napi::Function::New(env, _maxColourDistance));
|
35 | exports.Set("_isUsingJemalloc", Napi::Function::New(env, _isUsingJemalloc));
|
36 | exports.Set("stats", Napi::Function::New(env, stats));
|
37 | return exports;
|
38 | }
|
39 |
|
40 | NODE_API_MODULE(sharp, init)
|