39 lines
1.0 KiB
HTML
39 lines
1.0 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Document</title>
|
||
|
<script>
|
||
|
const fs = require('fs');
|
||
|
|
||
|
const readFile = function (fileName) {
|
||
|
return new Promise(function (resolve, reject) {
|
||
|
fs.readFile(fileName, function(error, data) {
|
||
|
if (error) return reject(error);
|
||
|
resolve(data);
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
const gen = function* () {
|
||
|
const f1 = yield readFile('/etc/fstab');
|
||
|
const f2 = yield readFile('/etc/shells');
|
||
|
console.log(f1.toString());
|
||
|
console.log(f2.toString());
|
||
|
};
|
||
|
|
||
|
|
||
|
var gen1=async function(){
|
||
|
const f1 = await readFile('/etc/fstab');
|
||
|
const f2 = await readFile('/etc/shells');
|
||
|
console.log(f1.toString());
|
||
|
console.log(f2.toString());
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
</body>
|
||
|
</html>
|