File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1- import * as fsPromises from 'fs/promises' ;
21import * as fs from 'fs' ;
32import * as path from 'path' ;
43import * as tar from 'tar' ;
54import axios from 'axios' ;
65import * as unzipper from 'unzipper' ;
76import { logger } from "../wrapper/loggerConfig" ;
87import { finished } from 'stream/promises' ;
8+ import { promisify } from "node:util" ;
99
1010type SupportedPlatforms = 'win32' | 'darwin' | 'linux' ;
11+ const readFileAsync = promisify ( fs . readFile ) ;
1112
1213export class CxInstaller {
1314 private readonly platform : string ;
@@ -106,15 +107,15 @@ export class CxInstaller {
106107 private checkExecutableExists ( ) : boolean {
107108 return fs . existsSync ( this . getExecutablePath ( ) ) ;
108109 }
109-
110+
110111 private async readASTCLIVersion ( ) : Promise < string > {
111112 if ( this . cliVersion ) {
112113 return this . cliVersion ;
113114 }
114115 try {
115116 const versionFilePath = path . join ( 'checkmarx-ast-cli.version' ) ;
116- const versionContent = await fsPromises . readFile ( versionFilePath , 'utf-8' ) ;
117- return versionContent . trim ( ) ;
117+ const versionContent = await readFileAsync ( versionFilePath ) ;
118+ return versionContent . toString ( ) . trim ( ) ;
118119 } catch ( error ) {
119120 logger . warn ( 'Error reading AST CLI version: ' + error . message ) ;
120121 return this . cliDefaultVersion ;
You can’t perform that action at this time.
0 commit comments