Enter your code
import { readFileSync, writeFileSync } from 'node:fs' console.info('Starting...') const fn = async (value: string)=> { console.debug(value) writeFileSync('./text.txt', value) return readFileSync('./text.txt') } console.warn('Might be cool!') const getExample = async ()=> { const response = await fetch('https://sebastianwessel.github.io/quickjs/example-request.html') if(!response.ok) { console.error('Request failed: ' + response.status + ' ' + response.statusText) return } const body = await response.text() console.log('Response body: '+ body) return body } await getExample() console.warn('top-level await is nice') export default await fn('Hello World')
Run Code
Result