# picup

> picture compress & upload

Latest version **0.1.0** (published 2018-08-07) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-08-07 |
| First published | 2018-08-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jo Zhou |
| Maintainers | baldyellow |
| Keywords | picup |

## Links

- npm: https://www.npmjs.com/package/picup
- Repository: https://github.com/baldyellow/picup
- Homepage: https://github.com/baldyellow/picup#readme
- Issues: https://github.com/baldyellow/picup/issues
- npm.io page: https://npm.io/package/picup

## Recent versions

- 0.1.0 (latest) — 2018-08-07

## README

# Picup

> Picture compress & upload

## Include

- with \<script\>

    your_page.html

    ```
    <script src="path/to/picup.js"></script>
    ```

- with Vue.js

    local picup package.json

    ```
    {
        "name": "picup",
        "main": "path/to/picup.js",
        ...
    }
    ```

    vue package.json

    ```
    "devDependencies": {
        ...
        "picup": "file:directory/to/local/picup/package/",
        ...
    },
    ```

    install local picup package

    ```
    npm install
    ```

    your_page.vue

    ```
    import Picup from 'picup'
    ```

## Usage

```
Picup(input_file_element, option)
```

## Option

```
{
    'ratio': 1.0,
    'upload': true,
    'showCompressLoading': true,
    'showUploadLoading': true,
    'xhr': {
        'url': '',
        'type': 'POST',
        'fileField': '',
        'otherData': {},
        'success': function success(res) {
            console.log(res);
        },
        'fail': function (xhr) {}
    },
    'hook': {
        'afterInputChange': function () {},
        'beforeReadFile': function (file) {},
        'afterReadFile': function (file) {},
        'beforeCompressImg': function (originBase64Data) {},
        'afterCompressImg': function (base64Data, originBase64Data) {},
        'beforeUploadImg': function (blob, base64Data) {},
        'afterUploadImg': function (blob, base64Data, isAbort) {}
    },
    'errorHandler': function errorHandler(err) {
        console.error(err);
    }
}
```

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