Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { CLOUD_DOWNLOAD_CONFIG } from '../../config/config';
import Aria2 from 'aria2';
const aria2 = new Aria2(CLOUD_DOWNLOAD_CONFIG);
export default class DownloadManager {
constructor(dir) {
this.connected = false;
this.dir = dir;
this.aria2 = aria2;
this.aria2.on('close', () => {
console.log('Disconnected from the download manager.');
this.connected = false;
this.connect();
});
this.aria2.on('open', () => {
console.log('Connected to the download manager.');
initClient () {
const {
rpcListenPort: port,
rpcSecret: secret
} = this.config
const host = '127.0.0.1'
this.client = new Aria2({
host,
port,
secret
})
this.client.open()
}
constructor(settings) {
this.settings = settings;
this.aria2 = new Aria2(settings.toJSON());
}
import Aria2 from 'aria2';
const aria2 = new Aria2();
export const Open = () => aria2.open();
export const Close = () => aria2.close();
export const AddURI = (uri, options) => aria2.call('addUri', [uri], options);
export default aria2;
constructor (options = {}) {
this.options = options
this.client = null
this.loadConfig()
const {
rpcListenPort: port,
rpcSecret: secret
} = this.config
const host = '127.0.0.1'
this.client = new Aria2({
host,
port,
secret
})
this.client.open()
}