Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否可以设置node:fs权限限制策略 #363

Open
chenddcoder opened this issue Jul 5, 2024 · 1 comment
Open

是否可以设置node:fs权限限制策略 #363

chenddcoder opened this issue Jul 5, 2024 · 1 comment

Comments

@chenddcoder
Copy link

const fs=require('node:fs')
const files = fs.readdirSync('./');
const filePath = './newFile.txt';
fs.writeFile(filePath, '这是新文件的内容', (err) => {
if (err) {
console.error('文件创建时发生错误:', err);
} else {
console.log('文件创建成功!');
}
});
fs.unlink(filePath, (err) => {
if (err) {
console.error('删除文件时出错:', err);
} else {
console.log('文件删除成功!');
}
});

我发现fs可以创建成功文件,并且可以删除文件,能否配置javet的访问权限,例如不允许删除文件

@caoccao
Copy link
Owner

caoccao commented Jul 5, 2024

You may pass console arguments to Node.js. This is the standard way. Javet doesn't make changes to the Node.js source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants