file - 如何在javascript中使用puppeteer获取默认文件目录
问题描述
我仍然需要用 apify(puppeteer) 查找下载文件。
我怎样才能得到它的路径。我使用 javascript。
非常感谢。致以最诚挚的问候
我使用下面的代码
function getCurrentFilenames() {
const path = require('path');
const downloadPath1 = path.resolve('/home/myuser/Downloads');//path.resolve(__dirname, './downloads');
const fs = require('fs');
console.log("Current filenames:");
fs.readdirSync(downloadPath1).forEach(file => {
console.log(file);
});
}
解决方案
推荐阅读
- python - 为什么 XPATH 的 find_element 在迭代日期选择器时会提供太多的 Web 元素?
- python - 实现“查找所有”算法,在表格中显示匹配的行,并在单击表格单元格时跳转到行
- python - 如何在python中调用输入的数据类型
- emacs - Magit:更改差异中文件名的颜色
- python - Python - 与进程一起使用时,共享内存的大小默认为默认大小
- flutter - 带浏览量的 Navigator 2.0
- angular - 使用角度路由器实现简单的后退导航
- java - 使用 ConstraintValidator 使用拖曳类型进行自定义 bean 验证
- arrays - char数组和指向char数组的指针之间的区别
- reactjs - 开玩笑测试 useInterval React Hook 不起作用