Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 00a4ff0

Browse files
author
Vijay Ramamurthy
committed
use fs instead of fs/promises for compatibility with older vscode versions
1 parent 64f5ee5 commit 00a4ff0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/flowLSP/utils/getVerifiedFlowBinPath.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
import Logger from './Logger';
33
import importFresh from './importFresh';
44
import getExtensionPath from './getExtentionPath';
5-
// $FlowFixMe Flow doesn't recognize the fs/promises node module
6-
import { readFile, readdir, access } from 'fs/promises';
5+
import { promises } from 'fs';
76
import { createReadStream } from 'fs';
87
import path from 'path';
98
// $FlowFixMe Flow doesn't recognize crypto.verify
109
import { verify, createHash } from 'crypto';
1110
import { window } from 'vscode';
1211

12+
// fs/promises
13+
const { readFile, readdir, access } = promises;
14+
1315
function getFlowBinDirPrefixForPlatform(): null | string {
1416
return process.platform === 'darwin'
1517
? 'flow-osx-v' :
@@ -44,7 +46,7 @@ async function getShasums(flowBinModulePath: string, logger: Logger): Promise<Bu
4446
try {
4547
// try veryifying against SHASUM256.txt.sign
4648
const shasums = await readFile(path.join(flowBinModulePath, 'SHASUM256.txt'));
47-
const shasumsSignatureBase64 = await readFile(path.join(flowBinModulePath, 'SHASUM256.txt.sign'), { encoding: 'ascii' });
49+
const shasumsSignatureBase64 = await readFile(path.join(flowBinModulePath, 'SHASUM256.txt.sign'), 'ascii' );
4850
const shasumsSignature = Buffer.from(shasumsSignatureBase64, 'base64');
4951
const publicKey = await readFile(path.join(extensionPath, 'signing.pem'));
5052
if (!verify('sha256', shasums, publicKey, shasumsSignature)) {

0 commit comments

Comments
 (0)