# HG changeset patch # User wenzelm # Date 1646254397 -3600 # Node ID fa9ca4563d72e29367e134aae481201669ce2c71 # Parent f304a2a5080f14b4cd831639ef9c9b67088b59ee support for file-system operations; diff -r f304a2a5080f -r fa9ca4563d72 src/Tools/VSCode/extension/src/file.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Tools/VSCode/extension/src/file.ts Wed Mar 02 21:53:17 2022 +0100 @@ -0,0 +1,25 @@ +/* Author: Makarius + +File-system operations (see Pure/General/file.scala) +*/ + +'use strict'; + +import * as fs from 'fs/promises' +import { Buffer } from 'buffer' + + +export async function read_bytes(path: string): Promise +{ + return fs.readFile(path) +} + +export async function read(path: string): Promise +{ + return read_bytes(path).then(buffer => buffer.toString()) +} + +export async function read_json(path: string): Promise +{ + return read(path).then(JSON.parse) as Promise +}