n8n-nodes-sftp-custom 0.1.2 → 0.1.3

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.
@@ -135,17 +135,25 @@ class Sftp {
135
135
  conn.end();
136
136
  return reject(err);
137
137
  }
138
- const writeStream = sftp.createWriteStream(remotePath + binaryData.fileName);
139
- writeStream.on('close', () => {
138
+ // const writeStream = sftp.createWriteStream(remotePath + binaryData.fileName);
139
+ // writeStream.on('close', () => {
140
+ // conn.end();
141
+ // resolve(true);
142
+ // });
143
+ // writeStream.on('error', (err: Error) => {
144
+ // conn.end();
145
+ // reject(err);
146
+ // });
147
+ // writeStream.write(fileBuffer);
148
+ // writeStream.end();
149
+ const fullPath = remotePath + binaryData.fileName;
150
+ sftp.writeFile(fullPath, fileBuffer, (err) => {
140
151
  conn.end();
152
+ if (err) {
153
+ return reject(err);
154
+ }
141
155
  resolve(true);
142
156
  });
143
- writeStream.on('error', (err) => {
144
- conn.end();
145
- reject(err);
146
- });
147
- writeStream.write(fileBuffer);
148
- writeStream.end();
149
157
  });
150
158
  });
151
159
  conn.on('error', (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-sftp-custom",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "n8n node for SFTP with custom algorithms",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Genevieve-Lee-221/n8n-nodes-sftp-custom",