New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zsqnodetools

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zsqnodetools - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

48

dist/ftpTool.js

@@ -39,5 +39,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
function UploadFiles() {
return __awaiter(this, void 0, void 0, function () {
var ftp, fs, path, json5, ftpConfig, client, err_1;
var ftp, fs, json5, ftpConfig, client, fileList, _i, fileList_1, filePath, currentDir, isExist, err_1;
return __generator(this, function (_a) {

@@ -48,3 +49,2 @@ switch (_a.label) {

fs = require("fs");
path = require("path");
json5 = require("json5");

@@ -56,24 +56,43 @@ ftpConfig = json5.parse(fs.readFileSync("./ftp.config", { encoding: "utf-8" }));

case 1:
_a.trys.push([1, 6, 7, 8]);
_a.trys.push([1, 11, 12, 13]);
return [4 /*yield*/, client.access(ftpConfig.uploadconfig.ftpConnectConfig)];
case 2:
_a.sent();
return [4 /*yield*/, client.ensureDir(ftpConfig.uploadconfig.remotePath)];
return [4 /*yield*/, client.list(ftpConfig.uploadconfig.ftpConnectConfig)];
case 3:
fileList = _a.sent();
_i = 0, fileList_1 = fileList;
_a.label = 4;
case 4:
if (!(_i < fileList_1.length)) return [3 /*break*/, 8];
filePath = fileList_1[_i];
if (!filePath.isDirectory) return [3 /*break*/, 7];
currentDir = path.join(ftpConfig.uploadconfig.remotePath, filePath);
isExist = InPathList(ftpConfig.uploadconfig.ignoreList, filePath);
if (!!isExist) return [3 /*break*/, 7];
return [4 /*yield*/, client.ensureDir(currentDir)];
case 5:
_a.sent();
return [4 /*yield*/, client.clearWorkingDir()];
case 4:
case 6:
_a.sent();
_a.label = 7;
case 7:
_i++;
return [3 /*break*/, 4];
case 8: return [4 /*yield*/, client.ensureDir(ftpConfig.uploadconfig.remotePath)];
case 9:
_a.sent();
return [4 /*yield*/, client.uploadFromDir(ftpConfig.uploadconfig.uploadPath)];
case 5:
case 10:
_a.sent();
return [3 /*break*/, 8];
case 6:
return [3 /*break*/, 13];
case 11:
err_1 = _a.sent();
console.log(err_1);
return [2 /*return*/, false];
case 7:
case 12:
client.close();
return [7 /*endfinally*/];
case 8: return [2 /*return*/, true];
case 13: return [2 /*return*/, true];
}

@@ -84,2 +103,11 @@ });

exports.UploadFiles = UploadFiles;
function InPathList(list, targetPath) {
for (var filepath in list) {
var joinPath = path.join(filepath);
targetPath = path.join(targetPath);
if (joinPath == targetPath) {
return true;
}
}
}
//# sourceMappingURL=ftpTool.js.map
{
"name": "zsqnodetools",
"version": "1.0.12",
"version": "1.0.13",
"description": "tools of nodejs",

@@ -5,0 +5,0 @@ "repository": {

@@ -0,5 +1,5 @@

const path = require("path");
export async function UploadFiles() {
const ftp = require("basic-ftp");
const fs = require("fs");
const path = require("path");
const json5 = require("json5");

@@ -13,4 +13,15 @@ const ftpConfig = json5.parse(

await client.access(ftpConfig.uploadconfig.ftpConnectConfig);
// ignore files
const fileList = await client.list(ftpConfig.uploadconfig.ftpConnectConfig);
for(const filePath of fileList){
if(filePath.isDirectory){
const currentDir = path.join(ftpConfig.uploadconfig.remotePath, filePath);
const isExist = InPathList(ftpConfig.uploadconfig.ignoreList, filePath);
if(!isExist){
await client.ensureDir(currentDir);
await client.clearWorkingDir();
}
}
}
await client.ensureDir(ftpConfig.uploadconfig.remotePath);
await client.clearWorkingDir();
await client.uploadFromDir(ftpConfig.uploadconfig.uploadPath);

@@ -28,1 +39,11 @@ }

}
function InPathList(list: string[], targetPath: string) {
for(const filepath in list){
const joinPath = path.join(filepath);
targetPath = path.join(targetPath);
if(joinPath == targetPath){
return true;
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc