+9
-0
| 2.0.0 / 2018-10-10 | ||
| ================== | ||
| **features** | ||
| * [[`52c1043`](http://github.com/eggjs/egg-oss/commit/52c1043bff45281fbc6dd236ad3ee2abe52e62b9)] - feat: [BREAKING CHANGE] upgrade ali-oss to support async function (#6) (Haoliang Gao <<sakura9515@gmail.com>>) | ||
| **others** | ||
| * [[`c2a67f6`](http://github.com/eggjs/egg-oss/commit/c2a67f67a451f525930a786d466c124dcd01631f)] - test: update secure key (#7) (Haoliang Gao <<sakura9515@gmail.com>>) | ||
| 1.1.0 / 2017-10-12 | ||
@@ -3,0 +12,0 @@ ================== |
+3
-3
@@ -5,4 +5,4 @@ 'use strict'; | ||
| const OSS = require('ali-oss'); | ||
| const Wrapper = OSS.Wrapper; | ||
| const STS = OSS.STS; | ||
| const ClusterClient = OSS.ClusterClient; | ||
@@ -21,3 +21,3 @@ function checkBucketConfig(config) { | ||
| config.cluster.forEach(checkBucketConfig); | ||
| return new OSS.ClusterClient(config); | ||
| return new ClusterClient(config); | ||
| } | ||
@@ -30,5 +30,5 @@ | ||
| checkBucketConfig(config); | ||
| return new Wrapper(config); | ||
| return new OSS(config); | ||
| }); | ||
| app.createOss = app.oss.createInstance.bind(app.oss); | ||
| }; |
+10
-11
| { | ||
| "name": "egg-oss", | ||
| "version": "1.1.0", | ||
| "version": "2.0.0", | ||
| "description": "OSS plugin for egg", | ||
@@ -22,16 +22,15 @@ "eggPlugin": { | ||
| "dependencies": { | ||
| "ali-oss": "^4.10.1" | ||
| "ali-oss": "^6.0.1" | ||
| }, | ||
| "devDependencies": { | ||
| "autod": "^2.9.0", | ||
| "co": "^4.6.0", | ||
| "egg": "^1.9.0", | ||
| "egg-bin": "^4.3.3", | ||
| "egg-mock": "^3.12.2", | ||
| "eslint": "^4.8.0", | ||
| "eslint-config-egg": "^5.1.1", | ||
| "is-type-of": "^1.0.0" | ||
| "autod": "^3.0.1", | ||
| "egg": "^2.11.2", | ||
| "egg-bin": "^4.9.0", | ||
| "egg-mock": "^3.20.1", | ||
| "eslint": "^5.6.1", | ||
| "eslint-config-egg": "^7.1.0", | ||
| "is-type-of": "^1.2.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">=6.0.0" | ||
| "node": ">=8.0.0" | ||
| }, | ||
@@ -38,0 +37,0 @@ "scripts": { |
+22
-28
@@ -99,37 +99,31 @@ # egg-oss | ||
| The example below will upload file to oss using [the `file` mode of egg-multipart](https://github.com/eggjs/egg-multipart#enable-file-mode-on-config). | ||
| ```js | ||
| const path = require('path'); | ||
| const Controller = require('egg').Controller; | ||
| const fs = require('mz/fs'); | ||
| // upload a file in controller | ||
| module.exports = function*() { | ||
| const parts = this.multipart(); | ||
| let object; | ||
| let part; | ||
| part = yield parts; | ||
| while (part) { | ||
| if (part.length) { | ||
| // arrays are busboy fields | ||
| console.log('field: ' + part[0]); | ||
| console.log('value: ' + part[1]); | ||
| console.log('valueTruncated: ' + part[2]); | ||
| console.log('fieldnameTruncated: ' + part[3]); | ||
| module.exports = class extends Controller { | ||
| async upload() { | ||
| const ctx = this.ctx; | ||
| const file = ctx.request.files[0]; | ||
| const name = 'egg-oss-demo/' + path.basename(file.filename); | ||
| let result; | ||
| try { | ||
| result = await ctx.oss.put(name, file.filepath); | ||
| } finally { | ||
| await fs.unlink(file.filepath); | ||
| } | ||
| if (result) { | ||
| console.log('get oss object: %j', object); | ||
| ctx.unsafeRedirect(result.url); | ||
| } else { | ||
| // otherwise, it's a stream | ||
| console.log('field: ' + part.fieldname); | ||
| console.log('filename: ' + part.filename); | ||
| console.log('encoding: ' + part.encoding); | ||
| console.log('mime: ' + part.mime); | ||
| // file handle | ||
| object = yield this.oss.put('egg-oss-demo-' + part.filename, part); | ||
| ctx.body = 'please select a file to upload!'; | ||
| } | ||
| part = yield parts; | ||
| } | ||
| console.log('and we are done parsing the form!'); | ||
| if (object) { | ||
| console.log('get oss object: %j', object); | ||
| this.unsafeRedirect(object.url); | ||
| } else { | ||
| this.body = 'please select a file to upload!'; | ||
| } | ||
| } | ||
| }; | ||
| ``` | ||
@@ -136,0 +130,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10007
2.31%7
-12.5%192
-3.03%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated