# HG changeset patch # User wenzelm # Date 1646826100 -3600 # Node ID 598b4a1f61dca204351c68e0f29b1ce434547ee3 # Parent e1dd62dd55408db36a2695196df23a3d6a93c175 more operations; diff -r e1dd62dd5540 -r 598b4a1f61dc src/Tools/VSCode/extension/src/file.ts --- a/src/Tools/VSCode/extension/src/file.ts Wed Mar 09 11:29:34 2022 +0100 +++ b/src/Tools/VSCode/extension/src/file.ts Wed Mar 09 12:41:40 2022 +0100 @@ -6,7 +6,8 @@ 'use strict'; import * as path from 'path' -import * as fs from 'fs/promises' +import { readFile } from 'fs/promises' +import { readFileSync } from 'fs' import { Buffer } from 'buffer' import * as platform from './platform' import * as library from './library' @@ -135,7 +136,7 @@ export async function read_bytes(path: string): Promise { - return fs.readFile(platform_path(path)) + return readFile(platform_path(path)) } export async function read(path: string): Promise @@ -147,3 +148,18 @@ { return read(path).then(JSON.parse) as Promise } + +export function read_bytes_sync(path: string): Buffer +{ + return readFileSync(platform_path(path)) +} + +export function read_sync(path: string): string +{ + return read_bytes_sync(path).toString() +} + +export function read_json_sync(path: string): T +{ + return JSON.parse(read_sync(path)) +}