# qktools

> #### 描述 工具库

Latest version **2.0.5** (published 2021-11-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install qktools
pnpm add qktools
yarn add qktools
bun add qktools
```

## 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 | 2.0.5 |
| Published | 2021-11-19 |
| First published | 2021-05-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | lh |
| Maintainers | wuqinglaoxingxing |
| Keywords | qktools |

## Links

- npm: https://www.npmjs.com/package/qktools
- Repository: https://gitee.com/AnHuiNG/qk-tools
- npm.io page: https://npm.io/package/qktools

## Dependencies (1)

- [ssh2](https://npm.io/package/ssh2.md) ^0.8.9

## Recent versions

- 2.0.5 (latest) — 2021-11-19
- 2.0.4 — 2021-11-19
- 2.0.3 — 2021-07-30
- 2.0.2 — 2021-06-11
- 2.0.1 — 2021-05-19
- 2.0.0 — 2021-05-19

## README

# qktools

#### 描述
工具库

## qktools
```
const qktools = {
    qfs,  //文件处理工具
    qssh_c, //客户端上传服务器
}


qfs = {
    copySync,
    moveSync,
    delSync
}

qssh_c = {
    connect,  //获取连接
    connectP, //获取连接
    close,    //关闭连接
    getRemoteList,  //获取指定目录信息
    uploadFile,     //指定目录上传文件
    shell     //执行shell 脚本
}
```

## 例子
>const qktools = require('qktools')  

>1. 删除文件或文件夹  
>  qktools.qfs.delSync("./tmp")
>2. 拷贝文件或文件夹  
>qktools.qfs.copySync("./tmp","./tmp1")
>3. 移动文件或文件夹  
>qktools.qfs.moveSync("./tmp","./tmp1")
>4. 查找文件夹下指定后缀名文件  
>qktools.qfs.findFileByExt("/Users/mac/Desktop/ve/ve3","ve")


```javascript
// 文件上传,获取文件夹列表，执行shell  
    const qss_c= qktools.qssh_c
    const config = {
        host: 'xxx', // 服务器ip
        port: '22', // 端口一般默认22
        username: 'xx',
        password: 'xxx'
    }
    const params = {
        config,
        readyCb:function(conn){
            console.log("ready");
            //查询tmp目录下有的列表
            qss_c.getRemoteList(conn,"/tmp",function(err,list){
                console.log(err,list)
                qss_c.close(conn)
            })
            // 上传指定文件到指定目录目录
            qss_c.uploadFile(conn,localUrl,remoteUrl,function(){
                qss_c.close(conn)
            })
            // 执行相关shell操作
            qss_c.shell(conn,'ls -l\n exit \n')
        },
        errorCb:function(err){
            console.log(err);
        },
        endCb:function(){
            console.log("end");
        },
        closeCb:function(){
            console.log("close");
        }
    }
    qss_c.connectP(params)
```


## 引用
> const qktools = require('qktools')

## Cli

暂不支持

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