forked from celestiaorg/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
importBlobstream.mjs
42 lines (39 loc) · 1.34 KB
/
importBlobstream.mjs
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
import fs from 'fs';
import fetch from 'node-fetch';
const filesToImport = [
{
url: 'https://raw.githubusercontent.com/celestiaorg/orchestrator-relayer/main/docs/deploy.md',
fileName: 'blobstream-deploy.md',
},
{
url: 'https://raw.githubusercontent.com/celestiaorg/orchestrator-relayer/main/docs/keys.md',
fileName: 'blobstream-keys.md',
},
{
url: 'https://raw.githubusercontent.com/celestiaorg/orchestrator-relayer/main/docs/orchestrator.md',
fileName: 'blobstream-orchestrator.md',
},
{
url: 'https://raw.githubusercontent.com/celestiaorg/orchestrator-relayer/main/docs/relayer.md',
fileName: 'blobstream-relayer.md',
},
{
url: 'https://raw.githubusercontent.com/celestiaorg/orchestrator-relayer/main/docs/bootstrapper.md',
fileName: 'blobstream-bootstrapper.md',
}
];
async function importMarkdown(file) {
try {
const response = await fetch(file.url);
if (response.ok) {
const markdown = await response.text();
fs.writeFileSync(`./nodes/${file.fileName}`, markdown);
console.log(`Markdown file '${file.fileName}' successfully imported!`);
} else {
console.error(`Error fetching the markdown file: ${response.statusText}`);
}
} catch (error) {
console.error(`Error importing the markdown file: ${error.message}`);
}
}
filesToImport.forEach(importMarkdown);