-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.js
More file actions
35 lines (30 loc) · 1.04 KB
/
Copy pathtest.js
File metadata and controls
35 lines (30 loc) · 1.04 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
const gmeta = require("./gmeta");
console.log("GMeta: Test!");
// Using callback
gmeta("https://github.com", function (err, data) {
console.log("[CALLBACK] GMeta: Test from URL!", data);
});
gmeta(
'<title>GitHub</title><meta name="description" content="GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85 million projects.">',
function (err, data) {
console.log("[CALLBACK] GMeta: Test from HTML!", data);
},
true
);
(async () => {
try {
const result = await gmeta("https://github.com");
console.log("[PROMISE] GMeta: Test from URL!", result);
} catch (err) {
console.log(err);
}
try {
const result = await gmeta(
'<title>GitHub</title><meta name="description" content="GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85 million projects.">',
true
);
console.log("[PROMISE] GMeta: Test from HTML!", result);
} catch (err) {
console.log(err);
}
})();