sharp 0.30.7 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/sharp.cc CHANGED
@@ -22,7 +22,6 @@
22
22
  #include "stats.h"
23
23
 
24
24
  static void* sharp_vips_init(void*) {
25
- g_setenv("VIPS_MIN_STACK_SIZE", "2m", FALSE);
26
25
  vips_init("sharp");
27
26
  return nullptr;
28
27
  }
package/src/utilities.cc CHANGED
@@ -118,14 +118,25 @@ Napi::Value format(const Napi::CallbackInfo& info) {
118
118
  "ppm", "fits", "gif", "svg", "heif", "pdf", "vips", "jp2k"
119
119
  }) {
120
120
  // Input
121
- Napi::Boolean hasInputFile =
122
- Napi::Boolean::New(env, vips_type_find("VipsOperation", (f + "load").c_str()));
121
+ const VipsObjectClass *oc = vips_class_find("VipsOperation", (f + "load").c_str());
122
+ Napi::Boolean hasInputFile = Napi::Boolean::New(env, oc);
123
123
  Napi::Boolean hasInputBuffer =
124
124
  Napi::Boolean::New(env, vips_type_find("VipsOperation", (f + "load_buffer").c_str()));
125
125
  Napi::Object input = Napi::Object::New(env);
126
126
  input.Set("file", hasInputFile);
127
127
  input.Set("buffer", hasInputBuffer);
128
128
  input.Set("stream", hasInputBuffer);
129
+ if (hasInputFile) {
130
+ const VipsForeignClass *fc = VIPS_FOREIGN_CLASS(oc);
131
+ if (fc->suffs) {
132
+ Napi::Array fileSuffix = Napi::Array::New(env);
133
+ const char **suffix = fc->suffs;
134
+ for (int i = 0; *suffix; i++, suffix++) {
135
+ fileSuffix.Set(i, Napi::String::New(env, *suffix));
136
+ }
137
+ input.Set("fileSuffix", fileSuffix);
138
+ }
139
+ }
129
140
  // Output
130
141
  Napi::Boolean hasOutputFile =
131
142
  Napi::Boolean::New(env, vips_type_find("VipsOperation", (f + "save").c_str()));