| import { Injectable, HttpStatus } from '@nestjs/common'; |
| import * as fs from 'fs-extra'; |
| |
| import { Response } from 'express'; |
| @Injectable() |
| export class AppService { |
| saveGridFailures(sits: any, res: Function) { |
| const jsonString = JSON.stringify(sits); |
| return fs.writeFile('./store/public-sits.json', jsonString, err => { |
| if (err) { |
| throw err; |
| } else { |
| res(true, 'Successfully wrote file'); |
| } |
| }); |
| } |
| |
| getSITs(res: Function) { |
| fs.readFile('./store/public-sits.json', 'utf8', function(err, data) { |
| if (err) throw err; |
| else res(data); //do operation on data that generates say resultArray; |
| }); |
| } |
| } |