70 lines
1.9 KiB
HTML
70 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
</head>
|
|
<body>
|
|
<script src="./fs.js"></script>
|
|
<script>
|
|
fs.writeFile('_test.txt', '123中a文bc', 'utf-8', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
setTimeout(function () {
|
|
fs.writeFile('_test_bin.txt', 'abc=', 'base64', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 1000);
|
|
setTimeout(function () {
|
|
fs.readFile('_test.txt', 'utf-8', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 2000);
|
|
setTimeout(function () {
|
|
fs.readFile('_test_bin.txt', 'base64', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 3000);
|
|
setTimeout(function () {
|
|
fs.readdir('.', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 4000);
|
|
setTimeout(function () {
|
|
fs.writeMultiFiles(['_test.txt','_test_multi.txt'], ['abc=','abe='], function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 5000);
|
|
setTimeout(function () {
|
|
fs.mkdir('__test__', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 6000);
|
|
setTimeout(function () {
|
|
fs.moveFile('_test_bin.txt', '__test__/_test_bin.txt', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 7000);
|
|
setTimeout(function () {
|
|
fs.moveFile('_test.txt', '__test__/_test.txt', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 8000);
|
|
setTimeout(function () {
|
|
fs.moveFile('_test_multi.txt', '__test__/_test.txt', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 8000);
|
|
setTimeout(function () {
|
|
fs.deleteFile('__test__/_test_bin.txt', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 9000);
|
|
setTimeout(function () {
|
|
fs.deleteFile('__test__', function (e, d) {
|
|
console.log(e, d);
|
|
})
|
|
}, 10000);
|
|
|
|
</script>
|
|
</body>
|
|
</html> |