CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-xmlhttprequest

XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object

Overall
score

75%

Overview
Eval results
Files

task.mdevals/scenario-1/

Local File Fetcher

A small utility for retrieving UTF-8 text from local files addressed by file:// URLs, supporting both asynchronous and synchronous reads.

Capabilities

Fetch existing file asynchronously

  • Given a file:// URL pointing to fixtures/greeting.txt containing Hello from file!, reading the file resolves with the exact contents as a string. @test

Handle missing file

  • Reading a file:// URL for a missing file rejects with an Error whose message includes the requested file name. @test

Fetch synchronously

  • Reading fixtures/short.txt via its file:// URL using the synchronous entry point returns the exact content string without involving promises. @test

Implementation

@generates

API

export async function readLocalFile(fileUrl: string): Promise<string>;
export function readLocalFileSync(fileUrl: string): string;

Dependencies { .dependencies }

xmlhttprequest { .dependency }

Provides a browser-like request interface for HTTP(S) and local file URLs.

Install with Tessl CLI

npx tessl i tessl/npm-xmlhttprequest

tile.json