adonis-kraken
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "adonis-kraken", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Simplifies working with Kraken.io (image optimisation service) through Adonis", | ||
@@ -29,4 +29,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"request": "^2.85.0" | ||
"axios": "^0.18.0", | ||
"form-data": "^2.3.2" | ||
} | ||
} |
@@ -5,3 +5,4 @@ 'use strict' | ||
const stream = require("stream") | ||
const request = require("request") | ||
const axios = require("axios") | ||
const FormData = require('form-data') | ||
@@ -59,23 +60,23 @@ const Config = use('Config') | ||
* @param {Object} opts | ||
* @param {Function} cb | ||
*/ | ||
upload (opts = {}, cb) { | ||
async upload (opts = {}) { | ||
opts.auth = this.auth | ||
let formData = {} | ||
let form = new FormData() | ||
formData.file = (opts.file && opts.file instanceof stream.Stream) | ||
form.append('file', (opts.file && opts.file instanceof stream.Streamfile) | ||
? opts.file | ||
: fs.createReadStream(opts.file) | ||
) | ||
delete opts.file | ||
formData.data = JSON.stringify(opts) | ||
form.append('data', JSON.stringify(opts)) | ||
request.post({ | ||
url: `${this.api_url}/upload`, | ||
json: true, | ||
strictSSL: false, | ||
formData, | ||
}, this._createResponseHandler(cb)) | ||
axios.post(`${this.api_url}/upload`, form, { headers: form.getHeaders() }) | ||
.then((response) => response) | ||
.catch((error) => { | ||
console.log(error) | ||
return error | ||
}) | ||
} | ||
@@ -82,0 +83,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156
44407
2
+ Addedaxios@^0.18.0
+ Addedform-data@^2.3.2
+ Addedaxios@0.18.1(transitive)
+ Addedfollow-redirects@1.5.10(transitive)
+ Addedform-data@2.5.2(transitive)
+ Addedis-buffer@2.0.5(transitive)
- Removedrequest@^2.85.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.13.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)