Export Data In Custom File Format – Exporto.js

Category: Javascript | November 19, 2020
Author:AbmSourav
Views Total:141 views
Official Page:Go to website
Last Update:November 19, 2020
License:MIT

Preview:

Export Data In Custom File Format – Exporto.js

Description:

Exporto.js is a plain JavaScript library that converts your data into a blob object so that you can export and download the data in any file format you specify (like CSV, TXT, PDF, etc).

How to use it:

1. Download and insert the exporto.js script into the document.

<script src="dist/exporto/exporto.min.js"></script>

2. Create a download button or link to download your data.

<a class="export">Export</a>

3. Initialize the Exporto.js library and define the data to output.

const options = {
      targetNode: expt,
      id: 'exporto',
      data: 'css,html,javascript'
}
Exporto(options).loaded();

4. Determine the file type and extension. Default: plain text.

const options = {
      targetNode: expt,
      id: 'exporto',
      data: 'css,html,javascript',
      fileType: 'text/csv',
      fileExtension: '.csv'
}

5. Customize the appearance of the download button.

const options = {
      targetNode: expt,
      id: 'exporto',
      data: 'css,html,javascript',
      className: 'export-btn',
      buttonText: 'Export & Download'
}

You Might Be Interested In:


Leave a Reply