diff --git a/Backend/src/API.py b/Backend/src/API.py deleted file mode 100644 index a15ca2e1..00000000 --- a/Backend/src/API.py +++ /dev/null @@ -1,105 +0,0 @@ -from flask import Flask, request -from docx import Document - -app = Flask(__name__) - -@app.route('/find-sections', methods=['POST']) -def find_sections(): - # Check for missing request data - if 'file_path' not in request.json: - return 'Missing file_path field', 400 - if 'search_terms' not in request.json: - return 'Missing search_terms field', 400 - if 'sections' not in request.json: - return 'Missing sections field', 400 - if 'specifyLines' not in request.json: - return 'Missing specifyLines field', 400 - if 'use_total_lines' not in request.json: - return 'Missing use_total_lines field', 400 - if 'lines' not in request.json: - return 'Missing lines field', 400 - - # Get the file path from the request - file_path = request.json['file_path'] - - # Read the file - with open(file_path, 'r') as f: - Lines = f.readlines() - - # Get the search terms, sections, and lines from the request - search_terms = request.json['search_terms'] - sections = request.json['sections'] - specifyLines = request.json['specifyLines'] - use_total_lines = request.json['use_total_lines'] - total_lines = request.json['lines'] - - # Create a new document - document = Document() - - # Iterate over the search terms and find the corresponding sections - for term in search_terms: - lineNo = 0 - termLineNo = [] - termsNum = 0 - for line in Lines: - if term in line: - termLineNo.append(lineNo) - termsNum += 1 - print(termsNum, term) - lineNo += 1 - - # Add the sections to the document - for i in sections: - section_lines = specifyLines[i-1].split() - start_line = termLineNo[i-1] - line_empty = 0 - - if section_lines[0] == 'WHOLE' and use_total_lines == False: - while line_empty == 0: - if Lines[start_line] != "\n": - section = document.add_paragraph(Lines[start_line]) - start_line += 1 - else: - line_empty = 1 - - if section_lines[0] == 'WHOLE' and use_total_lines == True: - for _ in range(total_lines - start_line + termLineNo[i-1]): - section = document.add_paragraph(Lines[start_line]) - start_line += 1 - line_empty = 1 - else: - start_line += 1 - line_empty = 1 - - elif section_lines[0] == 'FIRST': - line_count = -1 - while line_count < int(section_lines[1]): - section = document.add_paragraph(Lines[start_line]) - start_line += 1 - line_count += 1 - - elif section_lines[0] == 'LAST': - line_count = -1 - document.add_paragraph(Lines[start_line]) - document.add_paragraph(Lines[start_line + 1]) - while line_count < int(section_lines[1]): - section = document.add_paragraph(Lines[start_line+10]) - start_line += 1 - line_count += 1 - - elif section_lines[0] == 'SPECIFIC': - specific_lines = [int(l) for l in section_lines[1].split(",")] - document.add_paragraph(Lines[start_line]) - for l in specific_lines: - section = document.add_paragraph(Lines[start_line + l + 1]) - - try: - # Save the document - document.save("/Users/samsam/orca_converter/Backend/docs/data_conversion.docx") - except Exception as e: - return f'Error saving document: {e}', 500 - - return 'OK' - -if __name__ == '__main__': - app.run(debug=True) \ No newline at end of file diff --git a/Backend/src/app.py b/Backend/src/app.py index be923a0c..f12d0f39 100644 --- a/Backend/src/app.py +++ b/Backend/src/app.py @@ -1,7 +1,10 @@ -from flask import Flask, request, jsonify +from flask import Flask, request, jsonify, make_response from flask_cors import CORS +from docx import Document +from pathlib import Path import logging import os +import json def create_app(): app = Flask(__name__) @@ -25,8 +28,7 @@ def file_upload(): if file and file.mimetype == 'text/plain': filename = os.path.join(uploads_dir, file.filename) file.save(filename) - print('File received successfully') - return {'message': 'Success'}, 200 + return {'message': 'Success', 'filename':filename}, 200 else: logging.error('Invalid file type') return {'message': 'Invalid file type'}, 400 @@ -42,6 +44,112 @@ def get_data(): } return jsonify(data), 200 + @app.route('/find-sections', methods=['POST']) + def find_sections(): + + #Ensures the additional data sent is properly received. + data = request.get_json(force=True) + + + # Extracting each piece of data from the JSON object + file_path = data['file_path'] + search_terms = data['search_terms'] + sections = list(map(int, data['sections'])) + temp_specify_lines = data['specify_lines'] + + use_total_lines = data.get('use_total_lines', False) + total_lines = data.get('total_lines', 2000) + + # Check for missing request data + if not all([file_path, search_terms, sections, temp_specify_lines]): + return jsonify({'error': 'Missing required fields'}), 400 + + specify_lines = [] + num = 0 + while num <= len(sections): + specify_lines.append(temp_specify_lines) + num += 1 + + # Read the file + with open(file_path, 'r') as f: + Lines = f.readlines() + + # Create a new document + document = Document() + + # Iterate over the search terms and find the corresponding sections + for term in search_terms: + lineNo = 0 + termLineNo = [] + termsNum = 0 + for line in Lines: + if term in line: + termLineNo.append(lineNo) + termsNum += 1 + lineNo += 1 + + # Add the sections to the document + for i in sections: + section_lines = specify_lines[i-1].split() + start_line = termLineNo[i-1] + line_empty = 0 + + if section_lines[0].upper() == 'WHOLE' and not use_total_lines: + while line_empty == 0: + if Lines[start_line] != "\n": + section = document.add_paragraph(Lines[start_line]) + start_line += 1 + else: + line_empty = 1 + + if section_lines[0].upper() == 'WHOLE' and use_total_lines: + for _ in range(total_lines - start_line + termLineNo[i-1]): + section = document.add_paragraph(Lines[start_line]) + start_line += 1 + line_empty = 1 + else: + start_line += 1 + line_empty = 1 + + elif section_lines[0].upper() == 'FIRST': + line_count = -1 + while line_count < int(section_lines[1]): + section = document.add_paragraph(Lines[start_line]) + start_line += 1 + line_count += 1 + + elif section_lines[0].upper() == 'LAST': + line_count = -1 + document.add_paragraph(Lines[start_line]) + document.add_paragraph(Lines[start_line + 1]) + while line_count < int(section_lines[1]): + section = document.add_paragraph(Lines[start_line+10]) + start_line += 1 + line_count += 1 + + elif section_lines[0].upper() == 'SPECIFIC': + specific_lines = [int(l) for l in section_lines[1].split(",")] + document.add_paragraph(Lines[start_line]) + for l in specific_lines: + section = document.add_paragraph(Lines[start_line + l + 1]) + + # Convert the document to bytes and return it as a response + try: + docx_bytes = save_document_to_bytes(document) + response = make_response(docx_bytes) + response.headers.set('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') + response.headers.set('Content-Disposition', 'attachment', filename='output.docx') + return response + except Exception as e: + return f'Error saving document: {e}', 500 + + def save_document_to_bytes(document): + """Save the Word document to a byte string.""" + from io import BytesIO + file_stream = BytesIO() + document.save(file_stream) + return file_stream.getvalue() + return app if __name__ == "__main__": diff --git a/frontend/orca_data_converter/package-lock.json b/frontend/orca_data_converter/package-lock.json index 2c36330d..cfa0f8b9 100644 --- a/frontend/orca_data_converter/package-lock.json +++ b/frontend/orca_data_converter/package-lock.json @@ -18,6 +18,7 @@ "@angular/platform-browser-dynamic": "^15.2.0", "@angular/router": "^15.2.0", "bootstrap": "^5.2.3", + "file-saver": "^2.0.5", "primeng": "^15.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", @@ -27,6 +28,7 @@ "@angular-devkit/build-angular": "^15.2.6", "@angular/cli": "^15.2.6", "@angular/compiler-cli": "^15.2.0", + "@types/file-saver": "^2.0.7", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.5.0", "karma": "~6.4.0", @@ -3767,6 +3769,12 @@ "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", "dev": true }, + "node_modules/@types/file-saver": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz", + "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==", + "dev": true + }, "node_modules/@types/http-proxy": { "version": "1.17.14", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.14.tgz", @@ -6218,6 +6226,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", diff --git a/frontend/orca_data_converter/package.json b/frontend/orca_data_converter/package.json index 7d36ed96..b3031680 100644 --- a/frontend/orca_data_converter/package.json +++ b/frontend/orca_data_converter/package.json @@ -20,6 +20,7 @@ "@angular/platform-browser-dynamic": "^15.2.0", "@angular/router": "^15.2.0", "bootstrap": "^5.2.3", + "file-saver": "^2.0.5", "primeng": "^15.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", @@ -29,6 +30,7 @@ "@angular-devkit/build-angular": "^15.2.6", "@angular/cli": "^15.2.6", "@angular/compiler-cli": "^15.2.0", + "@types/file-saver": "^2.0.7", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.5.0", "karma": "~6.4.0", diff --git a/frontend/orca_data_converter/src/app/views/dashboard/dashboard.component.ts b/frontend/orca_data_converter/src/app/views/dashboard/dashboard.component.ts index e29503f6..fecd87bd 100644 --- a/frontend/orca_data_converter/src/app/views/dashboard/dashboard.component.ts +++ b/frontend/orca_data_converter/src/app/views/dashboard/dashboard.component.ts @@ -1,20 +1,9 @@ -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import {SelectItem} from 'primeng/api'; +import { saveAs } from 'file-saver'; -interface Brand { - name: string; - search_terms: string; - sections: number; - specifyLines: string; - use_total_lines: boolean; - lines: number; -} -interface BrandsGroup { - groupName: string; - brands: Brand[]; -} @Component({ selector: 'app-dashboard', @@ -22,746 +11,28 @@ interface BrandsGroup { styleUrls: ['../dashboardView/dashboardView.component.css'] }) -export class DashboardComponent implements OnInit{ +export class DashboardComponent{ fileType = 'ORCA'; fileExtension = '.txt'; - brandGroups: BrandsGroup[] = []; - selectedBrands: Brand[] = []; public fileName: string; selectedFile: File | null = null; + searchTerms: string = ''; + specify_lines: string = ''; + sections: string = ''; + useTotalLines: boolean = false; + totalLines: number = 0; constructor(private readonly http: HttpClient) { } onFileSelected(event: any) { this.selectedFile = event.target.files[0]; + // console.log("file name full:", event.target.value); + // if(this.selectedFile){ + // this.fileName = this.selectedFile.name; + // } // Store filename for display } - - ngOnInit() { - this.brandGroups = [ - { - groupName: "Cartesian Coordinates (Angstroem)", - brands: [ - { - name: "Row 1", - search_terms: "cartesian coordinates (angstroem)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "cartesian coordinates (angstroem)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "cartesian coordinates (angstroem)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "cartesian coordinates (angstroem)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "cartesian coordinates (angstroem)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "cartesian coordinates (angstroem)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "cartesian coordinates (angstroem)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Cartesian Coordinates (A.U.)", - brands: [ - { - name: "Row 1", - search_terms: "cartesian coordinates (a.u.)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "cartesian coordinates (a.u.)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "cartesian coordinates (a.u.)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "cartesian coordinates (a.u.)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "cartesian coordinates (a.u.)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "cartesian coordinates (a.u.)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "cartesian coordinates (a.u.)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - - ] - }, - { - groupName: "Internal Coordinates (Angstroem)", - brands: [ - { - name: "Row 1", - search_terms: "internal coordinates (angstroem)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "internal coordinates (angstroem)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "internal coordinates (angstroem)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "internal coordinates (angstroem)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "internal coordinates (angstroem)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "internal coordinates (angstroem)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "internal coordinates (angstroem)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Internal Coordinates (A.U.)", - brands: [ - { - name: "Row 1", - search_terms: "internal coordinates (a.u.)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "internal coordinates (a.u.)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "internal coordinates (a.u.)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "internal coordinates (a.u.)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "internal coordinates (a.u.)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "internal coordinates (a.u.)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "internal coordinates (a.u.)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Basis Set Information", - brands: [ - { - name: "Row 1", - search_terms: "basis set information", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "basis set information", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "basis set information", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "basis set information", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Orbital Energies", - brands: [ - { - name: "Row 1", - search_terms: "orbital energies", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "orbital energies", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Mulliken Atomic Charges", - brands: [ - { - name: "Row 1", - search_terms: "mulliken atomic charges", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "mulliken atomic charges", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Mulliken Reduced Orbital Charges", - brands: [ - { - name: "Row 1", - search_terms: "mulliken reduced orbital charges", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "mulliken reduced orbital charges", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Loewdin Atomic Charges", - brands: [ - { - name: "Row 1", - search_terms: "loewdin atomic charges", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "loewdin atomic charges", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Timings", - brands: [ - { - name: "Row 1", - search_terms: "timings", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "timings", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "timings", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "timings", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "timings", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "timings", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "timings", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 8", - search_terms: "timings", - sections: 8, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Vibrational Frequencies", - brands: [ - { - name: "Row 1", - search_terms: "vibrational frequencies", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "vibrational frequencies", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "vibrational frequencies", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Normal Modes", - brands: [ - { - name: "Row 1", - search_terms: "normal modes", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "normal modes", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "normal modes", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "IR Spectrum", - brands: [ - { - name: "Row 1", - search_terms: "ir spectrum", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "ir spectrum", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "ir spectrum", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Thermochemistry at 298.15K", - brands: [ - { - name: "Row 1", - search_terms: "thermochemsitry at 298.15k", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "thermochemistry at 298.15k", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "thermochemistry at 298.15k", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Inner Energy", - brands: [ - { - name: "Row 1", - search_terms: "inner energy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "inner energy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "inner energy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Enthalpy", - brands: [ - { - name: "Row 1", - search_terms: "enthalpy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "enthalpy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "enthalpy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Entropy", - brands: [ - { - name: "Row 1", - search_terms: "entropy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "entropy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "entropy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Gibbs Free Energy", - brands: [ - { - name: "Row 1", - search_terms: "gibbs free energy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "gibbs free energy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "gibbs free energy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Cartesian Gradient", - brands: [ - { - name: "Row 1", - search_terms: "cartesian gradient", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "cartesian gradient", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "cartesian gradient", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "cartesian gradient", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "cartesian gradient", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "cartesian gradient", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - ]; - } - + checkEmpty(){ var inputValueFile = (document.getElementById("customFile")).files?.length; var inputValueFileName = (document.getElementById("fileNameInput")).value; @@ -778,16 +49,8 @@ export class DashboardComponent implements OnInit{ else{ return 1; } -} - - runBackend(){ - this.checkEmpty(); - this.http.post('https://github.com/oss-slu/orca_converter/blob/main/Backend/Backend/API.py', null).subscribe(); - console.log(this.fileName); - console.log(this.selectedBrands); - return this.selectedBrands, this.fileName; } - + onUpload() { if (!this.selectedFile) { console.error('No file selected'); @@ -800,10 +63,50 @@ export class DashboardComponent implements OnInit{ this.http.post('http://localhost:5000/upload', formData).subscribe( (response) => { console.log('File uploaded successfully:', response); + this.fileName = response.filename; }, (error) => { console.error('Error uploading file:', error); } ); } + + onSubmit() { + if (!this.selectedFile) { + alert('Please select a file.'); + return; + } + + const data: any ={ + file_path: this.fileName.toString(), + search_terms: this.searchTerms.split(","), + sections: this.sections.split(','), + specify_lines: this.specify_lines.toString(), + }; + + if (this.useTotalLines) { + data.use_total_lines = this.useTotalLines; + } + + if (this.totalLines) { + data.total_lines = this.totalLines; + } + + + const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); + + this.http.post('http://localhost:5000/find-sections', data, { headers, responseType: 'blob' }) + .subscribe( + (response) => { + const blob = response; // Already a Blob object + this.downloadDocument(blob); // Call function to download + }, + (error) => { + console.error('Error:', error); + } + ); + } + downloadDocument(blob: Blob) { + saveAs(blob, 'output.docx'); // Specify filename + } } \ No newline at end of file diff --git a/frontend/orca_data_converter/src/app/views/dashboardView/dashboardView.component.html b/frontend/orca_data_converter/src/app/views/dashboardView/dashboardView.component.html index a956ef85..fd5f16cc 100644 --- a/frontend/orca_data_converter/src/app/views/dashboardView/dashboardView.component.html +++ b/frontend/orca_data_converter/src/app/views/dashboardView/dashboardView.component.html @@ -4,49 +4,39 @@

Upload your {{ fileType }} data file

- +

Enter the terms you wish to search for (txt only):

Enter how you want the lines specified:

Number of sections?

Use total lines?

Total number of lines for output doc?

- +
\ No newline at end of file diff --git a/frontend/orca_data_converter/src/app/views/gaussianDashboard/gaussianDashboard.component.ts b/frontend/orca_data_converter/src/app/views/gaussianDashboard/gaussianDashboard.component.ts index 5e2c6e0f..18f5eee9 100644 --- a/frontend/orca_data_converter/src/app/views/gaussianDashboard/gaussianDashboard.component.ts +++ b/frontend/orca_data_converter/src/app/views/gaussianDashboard/gaussianDashboard.component.ts @@ -1,20 +1,8 @@ -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import {SelectItem} from 'primeng/api'; +import { saveAs } from 'file-saver'; -interface Brand { - name: string; - search_terms: string; - sections: number; - specifyLines: string; - use_total_lines: boolean; - lines: number; -} - -interface BrandsGroup { - groupName: string; - brands: Brand[]; -} @Component({ selector: 'app-gaussianDashboard', @@ -22,745 +10,23 @@ interface BrandsGroup { styleUrls: ['../dashboardView/dashboardView.component.css'] }) -export class GaussianDashboardComponent implements OnInit{ +export class GaussianDashboardComponent { fileType = 'Gaussian'; fileExtension = '.log'; - brandGroups: BrandsGroup[] = []; - selectedBrands: Brand[] = []; public fileName: string; selectedFile: File | null = null; - + searchTerms: string = ''; + specify_lines: string = ''; + sections: number[] = []; + useTotalLines: boolean = false; + totalLines: number = 0; + constructor(private readonly http: HttpClient) { } onFileSelected(event: any) { this.selectedFile = event.target.files[0]; } - - ngOnInit() { - this.brandGroups = [ - { - groupName: "Cartesian Coordinates (Angstroem)", - brands: [ - { - name: "Row 1", - search_terms: "cartesian coordinates (angstroem)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "cartesian coordinates (angstroem)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "cartesian coordinates (angstroem)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "cartesian coordinates (angstroem)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "cartesian coordinates (angstroem)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "cartesian coordinates (angstroem)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "cartesian coordinates (angstroem)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Cartesian Coordinates (A.U.)", - brands: [ - { - name: "Row 1", - search_terms: "cartesian coordinates (a.u.)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "cartesian coordinates (a.u.)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "cartesian coordinates (a.u.)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "cartesian coordinates (a.u.)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "cartesian coordinates (a.u.)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "cartesian coordinates (a.u.)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "cartesian coordinates (a.u.)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - - ] - }, - { - groupName: "Internal Coordinates (Angstroem)", - brands: [ - { - name: "Row 1", - search_terms: "internal coordinates (angstroem)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "internal coordinates (angstroem)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "internal coordinates (angstroem)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "internal coordinates (angstroem)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "internal coordinates (angstroem)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "internal coordinates (angstroem)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "internal coordinates (angstroem)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Internal Coordinates (A.U.)", - brands: [ - { - name: "Row 1", - search_terms: "internal coordinates (a.u.)", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "internal coordinates (a.u.)", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "internal coordinates (a.u.)", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "internal coordinates (a.u.)", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "internal coordinates (a.u.)", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "internal coordinates (a.u.)", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "internal coordinates (a.u.)", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Basis Set Information", - brands: [ - { - name: "Row 1", - search_terms: "basis set information", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "basis set information", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "basis set information", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "basis set information", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Orbital Energies", - brands: [ - { - name: "Row 1", - search_terms: "orbital energies", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "orbital energies", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Mulliken Atomic Charges", - brands: [ - { - name: "Row 1", - search_terms: "mulliken atomic charges", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "mulliken atomic charges", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Mulliken Reduced Orbital Charges", - brands: [ - { - name: "Row 1", - search_terms: "mulliken reduced orbital charges", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "mulliken reduced orbital charges", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Loewdin Atomic Charges", - brands: [ - { - name: "Row 1", - search_terms: "loewdin atomic charges", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "loewdin atomic charges", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Timings", - brands: [ - { - name: "Row 1", - search_terms: "timings", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "timings", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "timings", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "timings", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "timings", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "timings", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 7", - search_terms: "timings", - sections: 7, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 8", - search_terms: "timings", - sections: 8, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Vibrational Frequencies", - brands: [ - { - name: "Row 1", - search_terms: "vibrational frequencies", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "vibrational frequencies", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "vibrational frequencies", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Normal Modes", - brands: [ - { - name: "Row 1", - search_terms: "normal modes", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "normal modes", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "normal modes", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "IR Spectrum", - brands: [ - { - name: "Row 1", - search_terms: "ir spectrum", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "ir spectrum", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "ir spectrum", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Thermochemistry at 298.15K", - brands: [ - { - name: "Row 1", - search_terms: "thermochemsitry at 298.15k", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "thermochemistry at 298.15k", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "thermochemistry at 298.15k", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Inner Energy", - brands: [ - { - name: "Row 1", - search_terms: "inner energy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "inner energy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "inner energy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Enthalpy", - brands: [ - { - name: "Row 1", - search_terms: "enthalpy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "enthalpy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "enthalpy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Entropy", - brands: [ - { - name: "Row 1", - search_terms: "entropy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "entropy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "entropy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Gibbs Free Energy", - brands: [ - { - name: "Row 1", - search_terms: "gibbs free energy", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "gibbs free energy", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "gibbs free energy", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - { - groupName: "Cartesian Gradient", - brands: [ - { - name: "Row 1", - search_terms: "cartesian gradient", - sections: 1, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 2", - search_terms: "cartesian gradient", - sections: 2, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 3", - search_terms: "cartesian gradient", - sections: 3, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 4", - search_terms: "cartesian gradient", - sections: 4, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 5", - search_terms: "cartesian gradient", - sections: 5, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - }, - { - name: "Row 6", - search_terms: "cartesian gradient", - sections: 6, - specifyLines: "WHOLE", - use_total_lines: false, - lines: 0 - } - ] - }, - ]; - } checkEmpty(){ var inputValueFile = (document.getElementById("customFile")).files?.length; @@ -780,30 +46,55 @@ export class GaussianDashboardComponent implements OnInit{ } } - runBackend(){ - this.checkEmpty(); - this.http.post('https://github.com/oss-slu/orca_converter/blob/main/Backend/Backend/API.py', null).subscribe(); - console.log(this.fileName); - console.log(this.selectedBrands); - return this.selectedBrands, this.fileName; +onUpload() { + if (!this.selectedFile) { + console.error('No file selected'); + return; } - onUpload() { - if (!this.selectedFile) { - console.error('No file selected'); - return; - } + const formData = new FormData(); + formData.append('file', this.selectedFile); - const formData = new FormData(); - formData.append('file', this.selectedFile); + this.http.post('http://localhost:5000/upload', formData).subscribe( + (response) => { + console.log('File uploaded successfully:', response); + this.fileName = response.filename; + }, + (error) => { + console.error('Error uploading file:', error); + } + ); +} - this.http.post('http://localhost:5000/upload', formData).subscribe( - (response) => { - console.log('File uploaded successfully:', response); - }, - (error) => { - console.error('Error uploading file:', error); - } - ); +onSubmit() { + if (!this.selectedFile) { + alert('Please select a file.'); + return; } + + const data = { + file_path: this.fileName.toString(), + search_terms: [this.searchTerms], + sections: this.sections, + specify_lines: this.specify_lines.toString(), + use_total_lines: this.useTotalLines, + total_lines: this.totalLines.toString(), + }; + + const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); + + this.http.post('http://localhost:5000/find-sections', data, { headers, responseType: 'blob' }) + .subscribe( + (response) => { + const blob = response; // Already a Blob object + this.downloadDocument(blob); // Call function to download + }, + (error) => { + console.error('Error:', error); + } + ); +} +downloadDocument(blob: Blob) { + saveAs(blob, 'output.docx'); // Specify filename +} } \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..ad821512 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,18 @@ +{ + "name": "esp", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@types/file-saver": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz", + "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==", + "dev": true + }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + } + } +} diff --git a/node_modules/@types/file-saver/LICENSE b/node_modules/@types/file-saver/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/file-saver/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/file-saver/README.md b/node_modules/@types/file-saver/README.md new file mode 100644 index 00000000..83546af9 --- /dev/null +++ b/node_modules/@types/file-saver/README.md @@ -0,0 +1,52 @@ +# Installation +> `npm install --save @types/file-saver` + +# Summary +This package contains type definitions for file-saver (https://github.com/eligrey/FileSaver.js/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/file-saver. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/file-saver/index.d.ts) +````ts +export = FileSaver; + +export as namespace saveAs; + +/** + * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. + * @param data - The actual file data blob or URL. + * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used. + * @param options - Optional FileSaver.js config + */ +declare function FileSaver(data: Blob | string, filename?: string, options?: FileSaver.FileSaverOptions): void; + +/** + * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. + * @param data - The actual file data blob or URL. + * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used. + * @param disableAutoBOM - Optional & defaults to `true`. Set to `false` if you want FileSaver.js to automatically provide Unicode text encoding hints + * @deprecated use `{ autoBom: false }` as the third argument + */ +// tslint:disable-next-line:unified-signatures +declare function FileSaver(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void; + +declare namespace FileSaver { + interface FileSaverOptions { + /** + * Automatically provide Unicode text encoding hints + * @default false + */ + autoBom: boolean; + } + + const saveAs: typeof FileSaver; +} + +```` + +### Additional Details + * Last updated: Tue, 07 Nov 2023 03:09:37 GMT + * Dependencies: none + +# Credits +These definitions were written by [Cyril Schumacher](https://github.com/cyrilschumacher), [Daniel Roth](https://github.com/DaIgeb), [HitkoDev](https://github.com/HitkoDev), [JounQin](https://github.com/JounQin), and [BendingBender](https://github.com/bendingbender). diff --git a/node_modules/@types/file-saver/index.d.ts b/node_modules/@types/file-saver/index.d.ts new file mode 100644 index 00000000..d52bcd1e --- /dev/null +++ b/node_modules/@types/file-saver/index.d.ts @@ -0,0 +1,33 @@ +export = FileSaver; + +export as namespace saveAs; + +/** + * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. + * @param data - The actual file data blob or URL. + * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used. + * @param options - Optional FileSaver.js config + */ +declare function FileSaver(data: Blob | string, filename?: string, options?: FileSaver.FileSaverOptions): void; + +/** + * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. + * @param data - The actual file data blob or URL. + * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used. + * @param disableAutoBOM - Optional & defaults to `true`. Set to `false` if you want FileSaver.js to automatically provide Unicode text encoding hints + * @deprecated use `{ autoBom: false }` as the third argument + */ +// tslint:disable-next-line:unified-signatures +declare function FileSaver(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void; + +declare namespace FileSaver { + interface FileSaverOptions { + /** + * Automatically provide Unicode text encoding hints + * @default false + */ + autoBom: boolean; + } + + const saveAs: typeof FileSaver; +} diff --git a/node_modules/@types/file-saver/package.json b/node_modules/@types/file-saver/package.json new file mode 100644 index 00000000..af7f9670 --- /dev/null +++ b/node_modules/@types/file-saver/package.json @@ -0,0 +1,45 @@ +{ + "name": "@types/file-saver", + "version": "2.0.7", + "description": "TypeScript definitions for file-saver", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/file-saver", + "license": "MIT", + "contributors": [ + { + "name": "Cyril Schumacher", + "githubUsername": "cyrilschumacher", + "url": "https://github.com/cyrilschumacher" + }, + { + "name": "Daniel Roth", + "githubUsername": "DaIgeb", + "url": "https://github.com/DaIgeb" + }, + { + "name": "HitkoDev", + "githubUsername": "HitkoDev", + "url": "https://github.com/HitkoDev" + }, + { + "name": "JounQin", + "githubUsername": "JounQin", + "url": "https://github.com/JounQin" + }, + { + "name": "BendingBender", + "githubUsername": "bendingbender", + "url": "https://github.com/bendingbender" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/file-saver" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "fff70ecd1cd1d1cd4b827d5e090ff94e2591f9044912e4e01ebd176d4eca9e14", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/file-saver/CHANGELOG.md b/node_modules/file-saver/CHANGELOG.md new file mode 100644 index 00000000..c8c7955f --- /dev/null +++ b/node_modules/file-saver/CHANGELOG.md @@ -0,0 +1,64 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.0.5] - 2020-11-18 + +- Fix server side rendering + +## [2.0.2] - 2019-05-14 + +- Catching an exception on Send (HEAD) ([#534]) + +## [2.0.0] - 2018-10-17 + +- Removed eval to resolve CSP ([#465]) + +## [2.0.0-rc.4] - 2018-10-17 + +- Don’t throw on module.exports + +## [2.0.0-rc.3] - 2018-09-27 + +- Switch export method + +## [2.0.0-rc.2] - 2018-09-26 + +- Added a changelog.md +- Reverted `a.click()` to use dispatch with a try-catch ([#465], [#382]) +- Made third argument to an object where you have to pass `{ autoBom: true }` + - boolean are depricated but still works + +## [2.0.0-rc.1] - 2018-09-26 + +- saveAs don't return anything + - The object that dispatched `writestart progress write writeend` are gone + - detecting such features was never possible and nobody seems to use it. +- Removed the demo folder +- Removed date/version from top of the file +- Dosen't crash in web workers ([#449]) +- Support saving urls ([#260] with workarounds for cross origin) +- Uses babel universal module pattern (UMD) to export the package +- Provides source map now as well. +- use a[download] before msSaveAs ([#193], [#294]) +- removed dist from .gitignore (npm uses it if it don't find a .npmignore) +- autoBom is now reversed so you have to tell when you want to use autoBom ([#432]) +- `a.click()` since there are new and depricated event constructors that works differently ([#382]) +- opens up a new popup (tab) directly for the fallback method since the FileReader is async +- removed the explicitly MSIE [1-9] check +- Uses new anchor link for each save (might solve multiple download problems) + + [#382]: https://github.com/eligrey/FileSaver.js/issues/382 + [#449]: https://github.com/eligrey/FileSaver.js/issues/449 + [#260]: https://github.com/eligrey/FileSaver.js/issues/260 + [#193]: https://github.com/eligrey/FileSaver.js/issues/193 + [#294]: https://github.com/eligrey/FileSaver.js/issues/294 + [#432]: https://github.com/eligrey/FileSaver.js/issues/432 + [#382]: https://github.com/eligrey/FileSaver.js/issues/382 + [#465]: https://github.com/eligrey/FileSaver.js/issues/465 + [#469]: https://github.com/eligrey/FileSaver.js/issues/469 + [#470]: https://github.com/eligrey/FileSaver.js/issues/470 + [#491]: https://github.com/eligrey/FileSaver.js/issues/491 + [#534]: https://github.com/eligrey/FileSaver.js/issues/534 diff --git a/node_modules/file-saver/LICENSE.md b/node_modules/file-saver/LICENSE.md new file mode 100644 index 00000000..32ef3ca0 --- /dev/null +++ b/node_modules/file-saver/LICENSE.md @@ -0,0 +1,11 @@ +The MIT License + +Copyright © 2016 [Eli Grey][1]. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + [1]: http://eligrey.com diff --git a/node_modules/file-saver/README.md b/node_modules/file-saver/README.md new file mode 100644 index 00000000..8cf55b0f --- /dev/null +++ b/node_modules/file-saver/README.md @@ -0,0 +1,150 @@ +If you need to save really large files bigger than the blob's size limitation or don't have +enough RAM, then have a look at the more advanced [StreamSaver.js][7] +that can save data directly to the hard drive asynchronously with the power of the new streams API. That will have +support for progress, cancelation and knowing when it's done writing + +FileSaver.js +============ + +FileSaver.js is the solution to saving files on the client-side, and is perfect for +web apps that generates files on the client, However if the file is coming from the +server we recommend you to first try to use [Content-Disposition][8] attachment response header as it has more cross-browser compatiblity. + +Looking for `canvas.toBlob()` for saving canvases? Check out +[canvas-toBlob.js][2] for a cross-browser implementation. + +Supported Browsers +------------------ + +| Browser | Constructs as | Filenames | Max Blob Size | Dependencies | +| -------------- | ------------- | ------------ | ------------- | ------------ | +| Firefox 20+ | Blob | Yes | 800 MiB | None | +| Firefox < 20 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | +| Chrome | Blob | Yes | [2GB][3] | None | +| Chrome for Android | Blob | Yes | [RAM/5][3] | None | +| Edge | Blob | Yes | ? | None | +| IE 10+ | Blob | Yes | 600 MiB | None | +| Opera 15+ | Blob | Yes | 500 MiB | None | +| Opera < 15 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | +| Safari 6.1+* | Blob | No | ? | None | +| Safari < 6 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | +| Safari 10.1+   | Blob         | Yes         | n/a           | None | + +Feature detection is possible: + +```js +try { + var isFileSaverSupported = !!new Blob; +} catch (e) {} +``` + +### IE < 10 + +It is possible to save text files in IE < 10 without Flash-based polyfills. +See [ChenWenBrian and koffsyrup's `saveTextAs()`](https://github.com/koffsyrup/FileSaver.js#examples) for more details. + +### Safari 6.1+ + +Blobs may be opened instead of saved sometimes—you may have to direct your Safari users to manually +press +S to save the file after it is opened. Using the `application/octet-stream` MIME type to force downloads [can cause issues in Safari](https://github.com/eligrey/FileSaver.js/issues/12#issuecomment-47247096). + +### iOS + +saveAs must be run within a user interaction event such as onTouchDown or onClick; setTimeout will prevent saveAs from triggering. Due to restrictions in iOS saveAs opens in a new window instead of downloading, if you want this fixed please [tell Apple how this WebKit bug is affecting you](https://bugs.webkit.org/show_bug.cgi?id=167341). + +Syntax +------ +### Import `saveAs()` from file-saver +```js +import { saveAs } from 'file-saver'; +``` + +```js +FileSaver saveAs(Blob/File/Url, optional DOMString filename, optional Object { autoBom }) +``` + +Pass `{ autoBom: true }` if you want FileSaver.js to automatically provide Unicode text encoding hints (see: [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)). Note that this is only done if your blob type has `charset=utf-8` set. + +Examples +-------- + +### Saving text using `require()` +```js +var FileSaver = require('file-saver'); +var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); +FileSaver.saveAs(blob, "hello world.txt"); +``` + +### Saving text + +```js +var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); +FileSaver.saveAs(blob, "hello world.txt"); +``` + +### Saving URLs + +```js +FileSaver.saveAs("https://httpbin.org/image", "image.jpg"); +``` +Using URLs within the same origin will just use `a[download]`. +Otherwise, it will first check if it supports cors header with a synchronous head request. +If it does, it will download the data and save using blob URLs. +If not, it will try to download it using `a[download]`. + +The standard W3C File API [`Blob`][4] interface is not available in all browsers. +[Blob.js][5] is a cross-browser `Blob` implementation that solves this. + +### Saving a canvas +```js +var canvas = document.getElementById("my-canvas"); +canvas.toBlob(function(blob) { + saveAs(blob, "pretty image.png"); +}); +``` + +Note: The standard HTML5 `canvas.toBlob()` method is not available in all browsers. +[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this. + +### Saving File + +You can save a File constructor without specifying a filename. If the +file itself already contains a name, there is a hand full of ways to get a file +instance (from storage, file input, new constructor, clipboard event). +If you still want to change the name, then you can change it in the 2nd argument. + +```js +// Note: Ie and Edge don't support the new File constructor, +// so it's better to construct blobs and use saveAs(blob, filename) +var file = new File(["Hello, world!"], "hello world.txt", {type: "text/plain;charset=utf-8"}); +FileSaver.saveAs(file); +``` + + + +![Tracking image](https://in.getclicky.com/212712ns.gif) + + [1]: http://eligrey.com/demos/FileSaver.js/ + [2]: https://github.com/eligrey/canvas-toBlob.js + [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=375297#c107 + [4]: https://developer.mozilla.org/en-US/docs/DOM/Blob + [5]: https://github.com/eligrey/Blob.js + [6]: https://github.com/eligrey/canvas-toBlob.js + [7]: https://github.com/jimmywarting/StreamSaver.js + [8]: https://github.com/eligrey/FileSaver.js/wiki/Saving-a-remote-file#using-http-header + +Installation +------------------ + +```bash +# Basic Node.JS installation +npm install file-saver --save +bower install file-saver +``` + +Additionally, TypeScript definitions can be installed via: + +```bash +# Additional typescript definitions +npm install @types/file-saver --save-dev +``` diff --git a/node_modules/file-saver/package.json b/node_modules/file-saver/package.json new file mode 100644 index 00000000..36398aee --- /dev/null +++ b/node_modules/file-saver/package.json @@ -0,0 +1,40 @@ +{ + "name": "file-saver", + "version": "2.0.5", + "description": "An HTML5 saveAs() FileSaver implementation", + "main": "dist/FileSaver.min.js", + "files": [ + "dist/FileSaver.js", + "dist/FileSaver.min.js", + "dist/FileSaver.min.js.map", + "src/FileSaver.js" + ], + "scripts": { + "test": "echo \"Error: no test specified\" && exit 0", + "build:development": "babel -o dist/FileSaver.js --plugins @babel/plugin-transform-modules-umd src/FileSaver.js", + "build:production": "babel -o dist/FileSaver.min.js -s --plugins @babel/plugin-transform-modules-umd --presets minify src/FileSaver.js", + "build": "npm run build:development && npm run build:production", + "prepublishOnly": "npm run build" + }, + "repository": { + "type": "git", + "url": "https://github.com/eligrey/FileSaver.js" + }, + "keywords": [ + "filesaver", + "saveas", + "blob" + ], + "author": "Eli Grey ", + "license": "MIT", + "bugs": { + "url": "https://github.com/eligrey/FileSaver.js/issues" + }, + "homepage": "https://github.com/eligrey/FileSaver.js#readme", + "devDependencies": { + "@babel/cli": "^7.1.0", + "@babel/core": "^7.1.0", + "@babel/plugin-transform-modules-umd": "^7.1.0", + "babel-preset-minify": "^0.4.3" + } +} diff --git a/node_modules/file-saver/src/FileSaver.js b/node_modules/file-saver/src/FileSaver.js new file mode 100644 index 00000000..5d204aee --- /dev/null +++ b/node_modules/file-saver/src/FileSaver.js @@ -0,0 +1,171 @@ +/* +* FileSaver.js +* A saveAs() FileSaver implementation. +* +* By Eli Grey, http://eligrey.com +* +* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) +* source : http://purl.eligrey.com/github/FileSaver.js +*/ + +// The one and only way of getting global scope in all environments +// https://stackoverflow.com/q/3277182/1008999 +var _global = typeof window === 'object' && window.window === window + ? window : typeof self === 'object' && self.self === self + ? self : typeof global === 'object' && global.global === global + ? global + : this + +function bom (blob, opts) { + if (typeof opts === 'undefined') opts = { autoBom: false } + else if (typeof opts !== 'object') { + console.warn('Deprecated: Expected third argument to be a object') + opts = { autoBom: !opts } + } + + // prepend BOM for UTF-8 XML and text/* types (including HTML) + // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF + if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { + return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type }) + } + return blob +} + +function download (url, name, opts) { + var xhr = new XMLHttpRequest() + xhr.open('GET', url) + xhr.responseType = 'blob' + xhr.onload = function () { + saveAs(xhr.response, name, opts) + } + xhr.onerror = function () { + console.error('could not download file') + } + xhr.send() +} + +function corsEnabled (url) { + var xhr = new XMLHttpRequest() + // use sync to avoid popup blocker + xhr.open('HEAD', url, false) + try { + xhr.send() + } catch (e) {} + return xhr.status >= 200 && xhr.status <= 299 +} + +// `a.click()` doesn't work for all browsers (#465) +function click (node) { + try { + node.dispatchEvent(new MouseEvent('click')) + } catch (e) { + var evt = document.createEvent('MouseEvents') + evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, + 20, false, false, false, false, 0, null) + node.dispatchEvent(evt) + } +} + +// Detect WebView inside a native macOS app by ruling out all browsers +// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too +// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos +var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent) + +var saveAs = _global.saveAs || ( + // probably in some web worker + (typeof window !== 'object' || window !== _global) + ? function saveAs () { /* noop */ } + + // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView + : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView) + ? function saveAs (blob, name, opts) { + var URL = _global.URL || _global.webkitURL + var a = document.createElement('a') + name = name || blob.name || 'download' + + a.download = name + a.rel = 'noopener' // tabnabbing + + // TODO: detect chrome extensions & packaged apps + // a.target = '_blank' + + if (typeof blob === 'string') { + // Support regular links + a.href = blob + if (a.origin !== location.origin) { + corsEnabled(a.href) + ? download(blob, name, opts) + : click(a, a.target = '_blank') + } else { + click(a) + } + } else { + // Support blobs + a.href = URL.createObjectURL(blob) + setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s + setTimeout(function () { click(a) }, 0) + } + } + + // Use msSaveOrOpenBlob as a second approach + : 'msSaveOrOpenBlob' in navigator + ? function saveAs (blob, name, opts) { + name = name || blob.name || 'download' + + if (typeof blob === 'string') { + if (corsEnabled(blob)) { + download(blob, name, opts) + } else { + var a = document.createElement('a') + a.href = blob + a.target = '_blank' + setTimeout(function () { click(a) }) + } + } else { + navigator.msSaveOrOpenBlob(bom(blob, opts), name) + } + } + + // Fallback to using FileReader and a popup + : function saveAs (blob, name, opts, popup) { + // Open a popup immediately do go around popup blocker + // Mostly only available on user interaction and the fileReader is async so... + popup = popup || open('', '_blank') + if (popup) { + popup.document.title = + popup.document.body.innerText = 'downloading...' + } + + if (typeof blob === 'string') return download(blob, name, opts) + + var force = blob.type === 'application/octet-stream' + var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari + var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent) + + if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') { + // Safari doesn't allow downloading of blob URLs + var reader = new FileReader() + reader.onloadend = function () { + var url = reader.result + url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;') + if (popup) popup.location.href = url + else location = url + popup = null // reverse-tabnabbing #460 + } + reader.readAsDataURL(blob) + } else { + var URL = _global.URL || _global.webkitURL + var url = URL.createObjectURL(blob) + if (popup) popup.location = url + else location.href = url + popup = null // reverse-tabnabbing #460 + setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s + } + } +) + +_global.saveAs = saveAs.saveAs = saveAs + +if (typeof module !== 'undefined') { + module.exports = saveAs; +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..c681278d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "esp", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "file-saver": "^2.0.5" + }, + "devDependencies": { + "@types/file-saver": "^2.0.7" + } + }, + "node_modules/@types/file-saver": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz", + "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==", + "dev": true + }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..a64e7fe1 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "file-saver": "^2.0.5" + }, + "devDependencies": { + "@types/file-saver": "^2.0.7" + } +}