Anc*_*nek 13 macos node.js electron
我想知道是否有办法使用Node将文件夹添加到收藏夹?
我发现了这个问题,但解决方案不再适用了.
基本上我感兴趣的文件位于:
/Users/USER_NAME/Library/Application\ Support/com.apple.sharedfilelist
Run Code Online (Sandbox Code Playgroud)
事情是我不知道如何修改它...
小智 2
您可以使用尝试os模块。非常容易使用。这是一个例子:
const home = require("os").homedir(); // This will get your OS based Home directory
const dirToSave = `${home}/Desktop/output.csv`; // Now you can add file or folder to any tree directory of home directory.
fs.writeFile(`${dirToSave}`, {csvData}, function(err, stat) {
if (err) throw err;
console.log("file saved");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
191 次 |
| 最近记录: |