blob: 331557a133cf50492bb2d6eda49d97a7a49bb587 [file] [log] [blame]
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;
});
}
}