XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object
Overall
score
75%
A small utility for retrieving UTF-8 text from local files addressed by file:// URLs, supporting both asynchronous and synchronous reads.
file:// URL pointing to fixtures/greeting.txt containing Hello from file!, reading the file resolves with the exact contents as a string. @testfile:// URL for a missing file rejects with an Error whose message includes the requested file name. @testfixtures/short.txt via its file:// URL using the synchronous entry point returns the exact content string without involving promises. @test@generates
export async function readLocalFile(fileUrl: string): Promise<string>;
export function readLocalFileSync(fileUrl: string): string;Provides a browser-like request interface for HTTP(S) and local file URLs.
Install with Tessl CLI
npx tessl i tessl/npm-xmlhttprequestdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10