gpt4 book ai didi

node.js - ElectronJS - 将文件夹添加到收藏夹 [macOS]

转载 作者:IT老高 更新时间:2023-10-28 23:08:46 24 4
gpt4 key购买 nike

我想知道是否有一种方法可以使用 Node 将文件夹添加到收藏夹?

我找到了 issue ,但该解决方案不再起作用。

基本上我感兴趣的文件位于:

/Users/USER_NAME/Library/Application\ Support/com.apple.sharedfilelist

问题是我不知道如何修改它...

最佳答案

您可以尝试使用 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");
});

关于node.js - ElectronJS - 将文件夹添加到收藏夹 [macOS],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51528513/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com