How to use js-file-downloader - 3 common examples

To help you get started, we’ve selected a few js-file-downloader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nerdic-coder / block-photos / src / pages / app-photos / app-photos.tsx View on Github external
zip.generateAsync({ type: 'base64' }).then((base64: string) => {
        new Downloader({
          url: 'data:application/zip;base64,' + base64,
          filename: 'block-photos.zip'
        })
          .then(() => {
            // Called when download ended
            this.downloadInProgress = false;
          })
          .catch(error => {
            // Called when an error occurred
            console.error(error);
            this.downloadInProgress = false;
            this.present.toast('Downloading of the photo failed!');
          });
      });
    }
github nerdic-coder / block-photos / src / pages / app-shared / app-shared.tsx View on Github external
async downloadOriginal(event: MouseEvent): Promise {
    event.preventDefault();
    this.downloadInProgress = true;

    new Downloader({
      url: this.photo.source,
      filename: this.photo.metadata.filename
    })
      .then(() => {
        // Called when download ended
        this.downloadInProgress = false;
      })
      .catch(error => {
        // Called when an error occurred
        console.error(error);
        this.downloadInProgress = false;
        this.present.toast('Downloading of the photo failed!');
      });
  }
github nerdic-coder / block-photos / src / pages / app-photo / app-photo.tsx View on Github external
async downloadOriginal(event: MouseEvent): Promise {
    event.preventDefault();
    this.downloadInProgress = true;
    const metadata: PhotoMetadata = await PhotosService.getPhotoMetaData(
      this.photoId
    );
    const data = await PhotosService.loadPhoto(metadata, PhotoType.Download);
    new Downloader({
      url: data,
      filename: metadata.filename
    })
      .then(() => {
        // Called when download ended
        this.downloadInProgress = false;
      })
      .catch(error => {
        // Called when an error occurred
        console.error(error);
        this.downloadInProgress = false;
        this.present.toast('Downloading of the photo failed!');
      });
  }

js-file-downloader

Small lib for a cool download experience

MIT
Latest version published 26 days ago

Package Health Score

71 / 100
Full package analysis

Popular js-file-downloader functions

Popular JavaScript code snippets

Find secure code to use in your application or website