Esempio n. 1
0
        }, (path) => {
          if (!path) {
            Notifier.alert('Please double check your filepath.');
          }
          else {
            Notifier.alert('Start to download your track !');
            // we got the path from fakeFile, so it's time to save
            // the real streaming file to override it !
            //
            // I know this idea is smart :)
            var downloadRequest = request.get(src).pipe(
              fs.createWriteStream(path));

            downloadRequest
              .on('error', () => {
                Notifier.alert('Sorry, something went wrong, please try again');
                console.log('error when saving file from stream');
              })
              .on('finish', () => {
                Notifier.alert('Download finished ! Go check your track :)');
              });
          }
        });
Esempio n. 2
0
 .catch((error) => {
   Notifier.alert(error);
 });
Esempio n. 3
0
 .on('finish', () => {
   Notifier.alert('Download finished ! Go check your track :)');
 });
Esempio n. 4
0
 .on('error', () => {
   Notifier.alert('Sorry, something went wrong, please try again');
   console.log('error when saving file from stream');
 })