@custom-js/n8n-nodes-pdf-toolkit 1.28.0 → 1.29.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.
@@ -89,6 +89,13 @@ class CompressPDF {
89
89
  json: true,
90
90
  };
91
91
  const response = await this.helpers.request(options);
92
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
93
+ // No binary data returned; emit only JSON without a binary property
94
+ returnData.push({
95
+ json: items[i].json,
96
+ });
97
+ continue;
98
+ }
92
99
  const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
93
100
  returnData.push({
94
101
  json: items[i].json,
@@ -99,6 +99,13 @@ class ExtractPages {
99
99
  json: true,
100
100
  };
101
101
  const response = await this.helpers.request(options);
102
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
103
+ // No binary data returned; emit only JSON without a binary property
104
+ returnData.push({
105
+ json: items[i].json,
106
+ });
107
+ continue;
108
+ }
102
109
  const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
103
110
  returnData.push({
104
111
  json: items[i].json,
@@ -58,6 +58,13 @@ class Html2Docx {
58
58
  json: true,
59
59
  };
60
60
  const response = await this.helpers.request(options);
61
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
62
+ // No binary data returned; emit only JSON without a binary property
63
+ returnData.push({
64
+ json: items[i].json,
65
+ });
66
+ continue;
67
+ }
61
68
  const binaryData = await this.helpers.prepareBinaryData(response, "output.docx");
62
69
  returnData.push({
63
70
  json: items[i].json,
@@ -58,6 +58,13 @@ class Html2Pdf {
58
58
  json: true,
59
59
  };
60
60
  const response = await this.helpers.request(options);
61
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
62
+ // No binary data returned; emit only JSON without a binary property
63
+ returnData.push({
64
+ json: items[i].json,
65
+ });
66
+ continue;
67
+ }
61
68
  const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
62
69
  returnData.push({
63
70
  json: items[i].json,
@@ -81,6 +81,13 @@ class MergePdfs {
81
81
  json: true,
82
82
  };
83
83
  const response = await this.helpers.request(options);
84
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
85
+ // No binary data returned; emit only JSON without a binary property
86
+ returnData.push({
87
+ json: {},
88
+ });
89
+ return [returnData];
90
+ }
84
91
  const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
85
92
  returnData.push({
86
93
  json: {},
@@ -121,6 +121,13 @@ class PdfFormFill {
121
121
  json: true,
122
122
  };
123
123
  const response = await this.helpers.request(options);
124
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
125
+ // No binary data returned; emit only JSON without a binary property
126
+ returnData.push({
127
+ json: items[i].json,
128
+ });
129
+ continue;
130
+ }
124
131
  const binaryData = await this.helpers.prepareBinaryData(response, "document.pdf");
125
132
  returnData.push({
126
133
  json: items[i].json,
@@ -89,6 +89,13 @@ class PdfToPng {
89
89
  json: true,
90
90
  };
91
91
  const response = await this.helpers.request(options);
92
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
93
+ // No binary data returned; emit only JSON without a binary property
94
+ returnData.push({
95
+ json: items[i].json,
96
+ });
97
+ continue;
98
+ }
92
99
  const binaryData = await this.helpers.prepareBinaryData(response, "output.png");
93
100
  returnData.push({
94
101
  json: items[i].json,
@@ -150,6 +150,13 @@ class Scraper {
150
150
  };
151
151
  const response = await this.helpers.request(options);
152
152
  if (returnValueType === "binary") {
153
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
154
+ // No binary data returned; emit only JSON without a binary property
155
+ returnData.push({
156
+ json: items[i].json,
157
+ });
158
+ continue;
159
+ }
153
160
  const binaryData = await this.helpers.prepareBinaryData(response, "output.png");
154
161
  returnData.push({
155
162
  json: items[i].json,
@@ -55,6 +55,13 @@ class WebsiteScreenshot {
55
55
  json: true,
56
56
  };
57
57
  const response = await this.helpers.request(options);
58
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
59
+ // No binary data returned; emit only JSON without a binary property
60
+ returnData.push({
61
+ json: items[i].json,
62
+ });
63
+ continue;
64
+ }
58
65
  const binaryData = await this.helpers.prepareBinaryData(response, "output.png");
59
66
  returnData.push({
60
67
  json: items[i].json,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@custom-js/n8n-nodes-pdf-toolkit",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "This is official node for interacting with APIs from customjs.space",
5
5
  "keywords": [
6
6
  "customjs",