Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ var convertapi = require('convertapi')('your-api-secret', {
username: 'testuser',
password: 'secret'
}
}
},
keepAlive: true
});
```

Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Options {
downloadTimeout?: number;
proxy?: object;
baseUri?: string;
keepAlive?: boolean;
}

export interface ResultFile {
Expand Down
2 changes: 2 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';
import fs from 'fs';
import https from 'https';
import { buildQueryString, encodeFileName } from './utils';
import UploadResult from './upload_result';
import Error from './error';
Expand Down Expand Up @@ -91,6 +92,7 @@ export default class Client {
maxBodyLength: Infinity,
timeout: this.api.uploadTimeout * 1000,
proxy: this.api.proxy,
httpsAgent: new https.Agent({ keepAlive: this.api.keepAlive }),
};

return axios(options)
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function ConvertAPI(secret, options = {}) {
this.downloadTimeout = options.downloadTimeout || 1800;
this.userAgent = `ConvertAPI-Node/${pkg.version}`;
this.proxy = options.proxy;
this.keepAlive = options.keepAlive !== undefined ? options.keepAlive : true;

this.client = new Client(this);
}
Expand Down