# zc-ftp-service

> zc ftp spring

Latest version **1.0.1** (published 2022-04-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install zc-ftp-service
pnpm add zc-ftp-service
yarn add zc-ftp-service
bun add zc-ftp-service
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-04-11 |
| First published | 2022-04-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yeqin |
| Maintainers | 892280082 |
| Keywords | ftp |

## Links

- npm: https://www.npmjs.com/package/zc-ftp-service
- Repository: git@gitee.com:woaianqi/zc-ftp-service
- npm.io page: https://npm.io/package/zc-ftp-service

## Dependencies (1)

- [ftp](https://npm.io/package/ftp.md) ^0.3.10

## Recent versions

- 1.0.1 (latest) — 2022-04-11
- 1.0.0 — 2022-04-08

## README

# zc-ftp-service

#### intruoduce
1. zhice teamson company development this module and all right reserved!
2. attention ! just suport the spring-ioc framework.


#### install 

npm instlal zc-ftp-service

#### usage 

##### 1.set the configuration file 

###### file path: ${Project}/resource/ZcFtpService.json
###### basic config:
```json
{
	"host":"222.222.222.22",
	"port":9022221,
	"user":"312342",
	"password":"zh3453453enmi345n"
}
```


#### 2. load ftp module at launch.
```js
const {SpringBoot} = require("spring-ioc")
const {ZcFtpServiceScaner} = require("zc-ftp-service")

new SpringBoot({srcList:["./demo"],moduleList:[ZcFtpServiceScaner]}).run();
```

#### 3. call in the spring container!
```js
//@SpringBoot
class Application {

	//@Autowired
	zcFtpService;

	async main(){

		try{


			this.zcFtpService.safeInvoke(async ftp => {

				console.log("ftp 主机 登陆成功");


				console.log("显示根目录 /");

				const datas = await ftp.list("/");
				const rootDirName = datas[0].name;
				console.log(`根目录名称:${rootDirName}`)

				ftp.cwd(rootDirName+"/ftptest")
				console.log("进入courware/ftptest目录成功");
				const data2s = await ftp.list("");
				console.log(data2s)

				const uploadDir = "uploadTestDir78";

				await ftp.mkdirAndGoto(uploadDir)
				console.log(`创建上传目录${uploadDir}成功`);

				const uploadInfo = await ftp.put(path.join(__dirname,'uploadTestA.txt'),"uploadTestA.txt")
				console.log("文件上传成功",uploadInfo);

				ftp.cwd("../")

				await ftp.rmdir(uploadDir)

				console.log("删除上传目录成功");

			})

		}catch(e){
			 await this.zcFtpService.close();
			console.log(e)
		}
		

	}

}
```

---
_Source: https://npm.io/package/zc-ftp-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
