Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adonis-kraken

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-kraken - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

5

package.json
{
"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"
}
}

25

src/Kraken/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc