How to use the file-saver/FileSaver.saveAs function in file-saver

To help you get started, we’ve selected a few file-saver 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 ParasolJS / parasol-es / src / api / exportData.js View on Github external
} else if (selection == 'marked') {
      d = config.marked;
    } else if (selection == 'both') {
      d = config.selections();
    } else {
      throw "Please specify one of {'brushed', 'marked', 'both'}";
    }

    if (d.length > 0) {
      // format data as csv
      // NOTE: include assigned data id number?
      const csv = csvFormat(d, config.vars);

      // create url and download
      const file = new Blob([csv], { type: 'text/csv' });
      saveAs(file, filename);
    } else {
      throw 'Error: No data selected.';
    }
    return this;
  };
github openkfw / TruBudget / frontend / src / sagas.js View on Github external
function*() {
      const data = yield callApi(api.export);
      saveAs(data, "TruBudget_Export.xlsx");
      yield put({
        type: EXPORT_DATA_SUCCESS
      });
    },
    true,
github spring-cloud / spring-cloud-dataflow-ui / ui / src / app / streams / stream-deploy / stream-deploy.component.ts View on Github external
runExport(value: Array) {
    this.update(value);
    if (this.properties.length === 0) {
      this.notificationService.error('There are no properties to export.');
    } else {
      const propertiesText = this.properties.join('\n');
      const date = DateTime.local().toFormat('yyyy-MM-HHmmss');
      const filename = `${this.refConfig.id}_${date}.txt`;
      const blob = new Blob([propertiesText], { type: 'text/plain' });
      saveAs(blob, filename);
    }
  }
github geli-lms / geli / app / webFrontend / src / app / report / report.component.ts View on Github external
private createDownload(csvContent: string[]) {
    const file = new Blob(csvContent, {type: 'text/csv'});
    saveAs(file, this.course.name.replace(/\s/g, '') + 'Report.csv');
  }
}
github nasa / openmct / src / exporters / CSVExporter.js View on Github external
export(rows, options) {
        let headers = (options && options.headers) ||
            (Object.keys((rows[0] || {})).sort());
        let filename = (options && options.filename) || "export.csv";
        let csvText = new CSV(rows, { header: headers }).encode();
        let blob = new Blob([csvText], { type: "text/csv" });
        saveAs(blob, filename);
    }
}
github Taskana / taskana / web / src / app / services / classification-definition / classification-definition.service.ts View on Github external
        response => saveAs(new Blob([JSON.stringify(response)], {type: 'text/plain;charset=utf-8'}),
          'Classifications_' + TaskanaDate.getDate() + '.json')
      );
github devilesk / dota-interactive-map / src / js / InteractiveMap.js View on Github external
canvas.toBlob((blob) => {
                    saveAs(blob, filename);
                    resetExport();
                });
            }
github FelixRilling / yugioh-deck-tool / src / components / YgoForms.vue View on Github external
fileDownloadDeck() {
      const fileData = convertDeckToFile(this.deckparts, this.deck.list);
      const file = new File([fileData], `${this.deck.name}.ydk`, {
        type: "text/ydk"
      });

      return FileSaver.saveAs(file);
    },
    copyShareText() {
github HaliteChallenge / Halite-III / website / javascript / templates / Visualizer.vue View on Github external
visualizer.encodeVideo().then((blob) => {
            this.recording = false;
            if (this.game && this.game.game_id) {
              saveAs(blob, `${this.game.game_id}.webm`);
            }
            else {
              saveAs(blob, 'video.webm');
            }
          });
        }

file-saver

An HTML5 saveAs() FileSaver implementation

MIT
Latest version published 4 years ago

Package Health Score

77 / 100
Full package analysis