-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlocal2pod.js
More file actions
executable file
·46 lines (42 loc) · 1.1 KB
/
local2pod.js
File metadata and controls
executable file
·46 lines (42 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { SolidNodeClient } from "solid-node-client";
const client = new SolidNodeClient;
async function local2pod(){
try {
await client.login();
}
catch(e){ console.log(e); }
for(let file of files){
const from = `file:///`+process.cwd()+ '/' + file;
const to = `https://solidproject.solidcommunity.net/catalog/${file}`;
try {
const getResponse = await client.fetch(from);
const content = await getResponse.text();
const contentType = getResponse.headers.get('Content-type');
const putResponse = await client.fetch( to, {
method:"PUT",
body:content,
headers:{"content-type":contentType}
});
console.log(putResponse.status,to)
}
catch(e){ console.log(e); }
}
}
const files = [
'index.html',
'catalog-data.ttl',
'catalog-skos.ttl',
'catalog-shacl.ttl',
'assets/logo.svg',
'viewer/form.js',
'viewer/forms.css',
'viewer/makeTOC.js',
'viewer/page-content.js',
'viewer/pages.js',
'viewer/showRecord.js',
'viewer/utils.js',
'viewer/viewer.css',
'viewer/viewer.html',
'viewer/viewer.js',
];
local2pod();