File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
- import fs from 'fs/promises' ;
2
- import { readFileSync } from 'fs' ;
3
-
4
1
import { CronExpression } from './CronExpression' ;
5
2
import { CronExpressionParser } from './CronExpressionParser' ;
6
3
@@ -21,7 +18,8 @@ export class CronFileParser {
21
18
* @throws If file cannot be read
22
19
*/
23
20
static async parseFile ( filePath : string ) : Promise < CronFileParserResult > {
24
- const data = await fs . readFile ( filePath , 'utf8' ) ;
21
+ const { readFile } = await import ( 'fs/promises' ) ;
22
+ const data = await readFile ( filePath , 'utf8' ) ;
25
23
return CronFileParser . #parseContent( data ) ;
26
24
}
27
25
@@ -32,6 +30,8 @@ export class CronFileParser {
32
30
* @throws If file cannot be read
33
31
*/
34
32
static parseFileSync ( filePath : string ) : CronFileParserResult {
33
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
34
+ const { readFileSync } = require ( 'fs' ) ;
35
35
const data = readFileSync ( filePath , 'utf8' ) ;
36
36
return CronFileParser . #parseContent( data ) ;
37
37
}
You can’t perform that action at this time.
0 commit comments