@things-factory/integration-sftp 5.0.0-alpha.47 → 5.0.0-alpha.48
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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateFile = void 0;
|
|
4
|
+
require("../sftp-s3");
|
|
5
|
+
const sftp_const_1 = require("../sftp-const");
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
async function generateFile(params) {
|
|
8
|
+
const { uploadPath, content, title } = params;
|
|
9
|
+
const fileDirectory = './uploaded-files';
|
|
10
|
+
if (!fs.existsSync(fileDirectory)) {
|
|
11
|
+
fs.mkdirSync(fileDirectory);
|
|
12
|
+
}
|
|
13
|
+
const filePath = fileDirectory + '/' + title;
|
|
14
|
+
fs.writeFile(filePath, content, function (err) {
|
|
15
|
+
if (err)
|
|
16
|
+
throw err;
|
|
17
|
+
console.log('File is created successfully.');
|
|
18
|
+
});
|
|
19
|
+
if (uploadPath) {
|
|
20
|
+
const stream = fs.createReadStream(filePath);
|
|
21
|
+
await sftp_const_1.SFTPFILESTORAGE.uploadFile({ stream, filename: title, uploadPath });
|
|
22
|
+
}
|
|
23
|
+
fs.rmdirSync(fileDirectory, { recursive: true });
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
exports.generateFile = generateFile;
|
|
27
|
+
//# sourceMappingURL=generate-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-file.js","sourceRoot":"","sources":["../../server/util/generate-file.ts"],"names":[],"mappings":";;;AAAA,sBAAmB;AAEnB,8CAA+C;AAE/C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAEjB,KAAK,UAAU,YAAY,CAAC,MAAW;IAC5C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAC7C,MAAM,aAAa,GAAG,kBAAkB,CAAA;IAExC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QACjC,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;KAC5B;IAED,MAAM,QAAQ,GAAG,aAAa,GAAG,GAAG,GAAG,KAAK,CAAA;IAE5C,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,GAAG;QAC3C,IAAI,GAAG;YAAE,MAAM,GAAG,CAAA;QAClB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,IAAI,UAAU,EAAE;QACd,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC5C,MAAM,4BAAe,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;KAC1E;IAED,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAEhD,OAAO,IAAI,CAAA;AACb,CAAC;AAvBD,oCAuBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-sftp",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.48",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
|
28
|
-
"@things-factory/biz-base": "^5.0.0-alpha.
|
|
29
|
-
"@things-factory/env": "^5.0.0-alpha.
|
|
30
|
-
"@things-factory/integration-fulfillment": "^5.0.0-alpha.
|
|
31
|
-
"@things-factory/shell": "^5.0.0-alpha.
|
|
27
|
+
"@things-factory/auth-base": "^5.0.0-alpha.48",
|
|
28
|
+
"@things-factory/biz-base": "^5.0.0-alpha.48",
|
|
29
|
+
"@things-factory/env": "^5.0.0-alpha.48",
|
|
30
|
+
"@things-factory/integration-fulfillment": "^5.0.0-alpha.48",
|
|
31
|
+
"@things-factory/shell": "^5.0.0-alpha.48",
|
|
32
32
|
"aws-sdk": "^2.960.0",
|
|
33
33
|
"xml-js": "^1.6.11"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0fa9b26abce176fa96d820fb50cc5565760d50c9"
|
|
36
36
|
}
|