2022-03-25 11:03:06 +00:00
|
|
|
import fetch, { RequestInfo, RequestInit } from "node-fetch";
|
|
|
|
import { SysCallMapping } from "../system";
|
|
|
|
|
|
|
|
export function fetchSyscalls(): SysCallMapping {
|
|
|
|
return {
|
2022-03-27 09:26:13 +00:00
|
|
|
async json(ctx, url: RequestInfo, init: RequestInit) {
|
2022-03-25 11:03:06 +00:00
|
|
|
let resp = await fetch(url, init);
|
|
|
|
return resp.json();
|
|
|
|
},
|
2022-03-27 09:26:13 +00:00
|
|
|
async text(ctx, url: RequestInfo, init: RequestInit) {
|
2022-03-25 11:03:06 +00:00
|
|
|
let resp = await fetch(url, init);
|
|
|
|
return resp.text();
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|