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

如何hook namespace里的api #2

Open
MarsToken opened this issue Dec 9, 2024 · 1 comment
Open

如何hook namespace里的api #2

MarsToken opened this issue Dec 9, 2024 · 1 comment

Comments

@MarsToken
Copy link

MarsToken commented Dec 9, 2024

`

let file = fileIo.openSync(context.cacheDir+'/test.txt',fileIo.OpenMode.CREATE|fileIo.OpenMode.WRITE_ONLY)

fileIo.writeSync(file.fd,'写入的测试文本')

fileIo.closeSync(file.fd)

`
如上代码,我想要hook fileIo的openSync、writeSync,如何实现呢?
fileIo为命名空间

@GkLwPp
Copy link
Collaborator

GkLwPp commented Dec 24, 2024

fileIo.openSync 属性不可改,无法直接修改。 可结合plugin方式修改(参考掘金文章:https://juejin.cn/post/7403261114762543154?searchId=20241224143855132D1C6C1BA6B8234D7E)
image

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