New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

convertapi

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convertapi - npm Package Compare versions

Comparing version
1.11.2
to
1.12.0
+16
-6
lib/task.js

@@ -41,4 +41,5 @@ 'use strict';

const fromFormat = _this.fromFormat || (0, _utils.detectFormat)(params, _this.toFormat);
const converter = params.converter ? `/converter/${params.converter}` : '';
const path = `convert/${fromFormat}/to/${_this.toFormat}${converter}`;
const converter = (0, _utils.detectConverter)(params);
const converterPath = converter ? `/converter/${converter}` : '';
const path = `convert/${fromFormat}/to/${_this.toFormat}${converterPath}`;
const response = yield _this.api.client.post(path, params, timeout);

@@ -55,8 +56,17 @@

const result = Object.assign({}, params, _this2.defaultParams);
const fileParams = Object.keys(params).filter(function (key) {
return key.endsWith('File') && key !== 'StoreFile';
});
if (params.File) {
const file = yield params.File;
result.File = yield (0, _utils.buildFileParam)(_this2.api, file);
}
yield Promise.all(fileParams.map((() => {
var _ref = _asyncToGenerator(function* (key) {
const file = yield params[key];
result[key] = yield (0, _utils.buildFileParam)(_this2.api, file);
});
return function (_x) {
return _ref.apply(this, arguments);
};
})()));
if (params.Files) {

@@ -63,0 +73,0 @@ const files = yield (0, _utils.normalizeFilesParam)(params.Files);

@@ -6,3 +6,3 @@ 'use strict';

});
exports.encodeFileName = exports.getReadableStream = exports.buildQueryString = exports.detectFormat = exports.buildFileParam = exports.normalizeFilesParam = undefined;
exports.detectConverter = exports.encodeFileName = exports.getReadableStream = exports.buildQueryString = exports.detectFormat = exports.buildFileParam = exports.normalizeFilesParam = undefined;

@@ -157,2 +157,10 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

return str.replace(/[!'()*]/g, c => `%${c.charCodeAt(0).toString(16)}`);
};
const detectConverter = exports.detectConverter = params => {
const converterKey = Object.keys(params).find(key => key.toLowerCase() === 'converter');
if (!converterKey) return undefined;
return params[converterKey];
};
{
"name": "convertapi",
"version": "1.11.2",
"version": "1.12.0",
"description": "Official convertapi.com API client",

@@ -58,3 +58,3 @@ "main": "./lib/index.js",

"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.0.0",
"eslint-config-airbnb": "~17.0.0",
"eslint-plugin-import": "^2.7.0",

@@ -61,0 +61,0 @@ "eslint-plugin-jsx-a11y": "^6.0.2",

@@ -66,3 +66,3 @@ # ConvertAPI Node.js Client

Convert file to PDF example. All supported file formats and options can be found
[here](https://www.convertapi.com).
[here](https://www.convertapi.com/conversions).

@@ -113,3 +113,3 @@ ```javascript

ConvertAPI accepts additional conversion parameters depending on selected formats. All conversion
parameters and explanations can be found [here](https://www.convertapi.com).
parameters and explanations can be found [here](https://www.convertapi.com/conversions).

@@ -149,2 +149,10 @@ ```javascript

### Alternative domain
Set `base_uri` parameter to use other service domains. Dedicated to the region [domain list](https://www.convertapi.com/doc/servers-location).
```js
var convertapi = require('../lib')(process.env.CONVERT_API_SECRET, { baseUri: 'https://eu-v2.convertapi.com/' });
```
### More examples

@@ -151,0 +159,0 @@

@@ -1,2 +0,7 @@

import { normalizeFilesParam, buildFileParam, detectFormat } from './utils';
import {
normalizeFilesParam,
buildFileParam,
detectFormat,
detectConverter,
} from './utils';
import Result from './result';

@@ -25,4 +30,5 @@

const fromFormat = this.fromFormat || detectFormat(params, this.toFormat);
const converter = params.converter ? `/converter/${params.converter}` : '';
const path = `convert/${fromFormat}/to/${this.toFormat}${converter}`;
const converter = detectConverter(params);
const converterPath = converter ? `/converter/${converter}` : '';
const path = `convert/${fromFormat}/to/${this.toFormat}${converterPath}`;
const response = await this.api.client.post(path, params, timeout);

@@ -35,7 +41,8 @@

const result = Object.assign({}, params, this.defaultParams);
const fileParams = Object.keys(params).filter(key => key.endsWith('File') && key !== 'StoreFile');
if (params.File) {
const file = await params.File;
result.File = await buildFileParam(this.api, file);
}
await Promise.all(fileParams.map(async (key) => {
const file = await params[key];
result[key] = await buildFileParam(this.api, file);
}));

@@ -42,0 +49,0 @@ if (params.Files) {

@@ -104,1 +104,9 @@ import path from 'path';

};
export const detectConverter = (params) => {
const converterKey = Object.keys(params).find(key => key.toLowerCase() === 'converter');
if (!converterKey) return undefined;
return params[converterKey];
};