在index.html中添加一个按钮,每按一次从本地读取一次文件:
<button id="btn1">按钮1</button>
修改preload.js:// preload.js
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener('DOMContentLoaded', () => {
省略号
let readAndDisplay = () => {
let fs = require("fs");
fs.readFile('local_file.txt', (err, data) => {
if (err) return console.error(err);
console.log(data.toString());
let myNode = document.createTextNode(data.toString());
document.body.insertBefore(myNode, document.body.firstChild);
});
}
document.querySelector('#btn1').addEventListener("click", event => {
readAndDisplay();
})
省略号
})
网友回复
ai大模型是不是遇到瓶颈了,现在只优化速度了?
python能写一个检测nginx rewrite高危漏洞的工具代码?
css如何给video视频进行mask遮罩?
windows如何同时允许两个用户远程桌面连接同一个电脑?
nginx升级到1.30.1导致无法启动 [emerg] SSL_CTX_new() failed怎么办?
什么是ASLR(地址随机化)?
有没有不依赖embedding向量的RAG技术?
有没有支持实时打断语音通话并后台帮你执行任何的ai模型?
开源ai大模型文件格式GGUF、MLX、Safetensors、 ONNX 有什么区别?
出海挣钱支付收款PayPal、Wise 、PingPong、Stripe如何选择?


