forked from joemaddalone/react-svg-path-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrab-docs.js
36 lines (32 loc) · 953 Bytes
/
grab-docs.js
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
const fs = require("fs");
const https = require("https");
// grab_docs is a function
// grab docs arguments: url, filename.
// grab docs fetches a url and saves it to a file.
// function grab_docs(url, filename) {
// // create a https request
// const req = https.get(url, (res) => {
// // write the response to a file
// res.on("data", (chunk) => {
// fs.writeFile(filename, chunk, (err) => {
// if (err) {
// console.log(err);
// }
// });
// });
// });
// }
const grab_docs = (url, filename) => {
const file = fs.createWriteStream(filename);
const request = https.get(url, function (response) {
response.pipe(file);
});
};
grab_docs(
"https://raw.githubusercontent.com/joemaddalone/react-svg-path/master/src/docs/docs.mjs",
"src/docs/docs.mjs"
);
grab_docs(
"https://raw.githubusercontent.com/joemaddalone/react-svg-path/master/src/docs/demos.mjs",
"src/docs/demos.mjs"
);