# eos-client

> restify客户端，作为Save项目的一部分，向eos-core发送rest请求，并接受返回信息。该客户端将被其他模块调用，如eos-adminui。

Latest version **0.0.4** (published 2017-04-13) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install eos-client
pnpm add eos-client
yarn add eos-client
bun add eos-client
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2017-04-13 |
| First published | 2017-04-09 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gavin Chan |
| Maintainers | gavin-chan |

## Links

- npm: https://www.npmjs.com/package/eos-client
- Repository: https://github.com/gavin-chan/node-eos-client
- Homepage: https://github.com/gavin-chan/node-eos-client#readme
- Issues: https://github.com/gavin-chan/node-eos-client/issues
- npm.io page: https://npm.io/package/eos-client

## Dependencies (2)

- [assert-plus](https://npm.io/package/assert-plus.md) ^1.0.0
- [restify-clients](https://npm.io/package/restify-clients.md) ^1.5.0

## Recent versions

- 0.0.4 (latest) — 2017-04-13
- 0.0.3 — 2017-04-12
- 0.0.2 — 2017-04-10
- 0.0.1 — 2017-04-09

## README

# node-eos-client
restify客户端，作为Save项目的一部分，向eos-core发送rest请求，并接受返回信息。该客户端将被其他模块调用，如eos-adminui。

# 使用说明
1. 安装eos-client：
      
      npm安装：`npm install eos-client --save`

      yarn安装：`yarn add eos-client`

2. 创建客户端：

    ```js
    /**
     * @params {object} opts
     *  - opts.core_addr {string} core地址
     *  - opts.core_port {number} core端口
     */
    let client = require('eos-client').createClient(opts);
    ```

3. 获取列表：
    
    ```js
    /*
     * @params {object} opts 筛选条件，此处应包含uploaded_by
     *  - opts.uploaded_by {string} 上传者uuid 
     *  - opts.type {string} 文件类型
     */
    client.getList(opts, 
    /*
     * @params {object} err 错误对象，当有错误时，err不为空，否则为空，需要进行处理
     * @params {object} res 请求正确时，返回的对象
     */
    (err, res) => {});
    ```

4. 上传
    
    ```js
    /*
     * @params {object} opts 上传信息
     *  - opts.path {string} 缓存路径，必需
     *  - opts.originalname {string} 原始文件名
     *  - opts.type {string} 文件类型
     *  - opts.visibility {string} 默认public
     *  - opts.uploaded_by {string} 上传者的id
     *  - opts.crypto {string} 加密方式，默认rc4
     *  - opts.key {string} 加密密码
     */
    client.upload(opts, (err, res) => {});
    ```

5. 下载
    
    ```js
    /*
     * @params {object} opts 上传信息
     *  - opts.cache_area {string} 缓存路径，必需
     *  - opts.uuid {string} 文件的uuid
     */
    client.download(opts, (err, res) => {});
    ```

6. 获取加密方式

    ```js
    client.download((err, res) => {});
    ```

# 许可
MPL v. 2. See [LICENSE](./LICENSE).

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