-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.js
More file actions
23 lines (21 loc) · 761 Bytes
/
util.js
File metadata and controls
23 lines (21 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { getAuthenticatedFetch } from "./client-credentials.js";
export async function cli(myFunction) {
const solidTargetInfo = process.argv.slice(2).reduce((acc, arg) => {
let [k, v = true] = arg.split('=')
acc[k] = v
return acc
}, {})
let response = await myFunction(solidTargetInfo);
let text = await response.text();
console.log(text);
}
export async function getResource(solidTargetInfo){
const { email, password, webId, oidcIssuer, absoluteURI } = solidTargetInfo;
let authFetch = await getAuthenticatedFetch(email, password, oidcIssuer, webId);
let response = await authFetch(absoluteURI, {
headers: {
'accept': 'application/n-quads'
}
});
return response;
}