1234567891011121314151617181920212223242526 |
- 'use strict';
- const defaults = require('./src/defaults');
- const musicQualities = require('./src/musicQualities');
- const downloadTypes = require('./src/downloadTypes');
- const downloadMultiple = require('./src/downloadMultiple');
- const deezerApi = require('deezer-request2');
- /**
- * Start a deezer download.from module
- *
- * @param {String} deezerUrl
- */
- const dFi = async (deezerUrl, path = defaults.DOWNLOAD_DIR, quality = musicQualities.selectedQuality.id) => {
- try {
- const downloadType = await downloadTypes(deezerUrl);
- if (downloadType.type == 'unknown') {
- throw { error: 'Invalid url', message: 'Unknown url type' };
- }
- return downloadMultiple(downloadType, path, quality);
- } catch (err) {
- return err;
- }
- };
- module.exports = { dFi, deezerApi };
|