# webpack-alioss-upload-plugin

> A webpack plugin to upload files to aliyun oss, which supports multiple optional upload method

Latest version **1.5.1** (published 2019-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-alioss-upload-plugin
pnpm add webpack-alioss-upload-plugin
yarn add webpack-alioss-upload-plugin
bun add webpack-alioss-upload-plugin
```

## 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.5.1 |
| Published | 2019-09-24 |
| First published | 2019-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Javen Leung |
| Maintainers | javen |
| Keywords | webpack4, plugin, aliyun, oss |

## Links

- npm: https://www.npmjs.com/package/webpack-alioss-upload-plugin
- Repository: https://github.com/avennn/webpack-alioss-upload-plugin
- Homepage: https://github.com/avennn/webpack-alioss-upload-plugin#readme
- Issues: https://github.com/avennn/webpack-alioss-upload-plugin/issues
- npm.io page: https://npm.io/package/webpack-alioss-upload-plugin

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [ali-oss](https://npm.io/package/ali-oss.md) ^6.1.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.3
- [progress](https://npm.io/package/progress.md) ^2.0.3

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2019-09-24
- 1.5.0 — 2019-04-17
- 1.4.2 — 2019-04-17
- 1.4.1 — 2019-03-18
- 1.4.0 — 2019-03-18
- 1.3.0 — 2019-03-18
- 1.2.0 — 2019-03-18
- 1.1.0 — 2019-03-15
- 1.0.0 — 2019-03-14

## README

# webpack-alioss-upload-plugin

A flexible webpack plugin to upload files to aliyun oss, which supports multiple optional upload methods and parameters.

> This plugin only works with webpack version above 4.0

## Advantages

- Supports 3 alternative upload methods that aliyun oss supports.

- Supports multipart upload and retries at the breakpoints.

- Can custom timeout to drop the request.

- Can control how many http request threads are created at the meanwhile. Too many threads may result in an error returned from aliyun.

- Can switch debug mode to decide whether or not showing verbose log.

## Installation

```bash
npm i webpack-alioss-upload-plugin -D
```

or

```bash
yarn add webpack-alioss-upload-plugin -D
```

## Usage

Here is a simplest usage.

```javascript
const AliOSSUploadPlugin = require("webpack-alioss-upload-plugin");
// webpack config
module.exports = {
  plugins: [
    new AliOSSUploadPlugin({
      accessKeyId: "your.oss.accessKeyId",
      accessKeySecret: "your.oss.accessKeySecret",
      region: "your.oss.region",
      bucket: "your.oss.bucket"
    })
  ]
};
```

## Options

- `accessKeyId`:&emsp;[String]&emsp;the accessKeyId of your oss, `required`.
- `accessKeySecret`:&emsp;[String]&emsp;the accessKeySecret of your oss, `required`.
- `region`:&emsp;[String]&emsp;the region of your oss, `required`.
- `bucket`:&emsp;[String]&emsp;the bucket name of your oss, `required`.
- `prefix`:&emsp;[String]&emsp;the path to direct to files on oss, if configured, it looks like "https://${bucket}.${region}.aliyuncs.com/${prefix}/local-resolved-file-name", default `''`.
- `uploadType`:&emsp;[String]&emsp;has three types(`put`|`stream`|`multipart`), corresponding to alioss's upload methods(`put`|`putStream`|`multipart`), default `multipart`, more info see [here](https://github.com/ali-sdk/ali-oss).
- `uploadOptions`:&emsp;[Object]
  - `parallel`:&emsp;[Number]&emsp;the number of parts to be uploaded in parallel, default `4`.
  - `partSize`:&emsp;[Number]&emsp;the suggested size for each part in `KB`, default `204800`(200M), alioss's minimum partsize must larger than 100M.
  - `timeout`:&emsp;[Number]&emsp;the operation timeout in milliseconds, default `6000`.
  - `retries`:&emsp;[Number]&emsp;retry times if multipart upload is interrupted, only work when uploadType is `multipart`
  - `useChunk`:&emsp;[Boolean]&emsp;whether or not use `chunked encoding`, only work when uploadType is `stream`, default `false`, more info see [here](https://github.com/ali-sdk/ali-oss#putstreamname-stream-options).
- `concurrency`:&emsp;[Number]&emsp;allow how many upload event to be created at the meanwhile, default `3`, may your system may crash if this parameter is too large.
- `excludes`:&emsp;[RegExp|Array[RegExp]]&emsp;files not wanting to upload to oss, default `[]`.
- `debug`:&emsp;[Boolean]&emsp;whether or not show verbose log on command line, default `false`.

## Contribution and Issues

Feel free to contribute code or publish an issue, whenever you have any good idea or find a bug.

## License

[MIT](./LICENSE)

## Author

Javen Leung

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