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

feat: node os module #64

Merged
merged 3 commits into from
Jul 7, 2022
Merged

Conversation

Puellaquae
Copy link
Contributor

@Puellaquae Puellaquae commented Jun 18, 2022

Implement node os module in js, WasmEdge/WasmEdge#1535 .
Module name "os" has been used by quickjs, and in windows "node:os" is not a valid name, so I named "nodeos" temporarily.
os.constants and os.networkInterfaces() return empty data.
os.getPriority(), os.loadavg() and os.userInfo() return fake data.
os.cpus() is unimplemented and will throw error.
os.totalmem() always return 4294967296 (4GiB, as much as wasm32 can use) and os.freemem() is totalmem() - memory.size.

@juntao juntao requested a review from L-jasmine June 18, 2022 20:36
Copy link
Collaborator

@L-jasmine L-jasmine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename nodeos.js to os.js

@Puellaquae
Copy link
Contributor Author

rename nodeos.js to os.js

Will this name not conflict with this quickjs built-in os module?

@Puellaquae
Copy link
Contributor Author

Or, should re-export built-in os module in os.js?

@L-jasmine
Copy link
Collaborator

rename nodeos.js to os.js

Will this name not conflict with this quickjs built-in os module?

Oh, I forget it.

js_init_module_os(ctx, "os\0".as_ptr() as *const i8);

quickjs built-in os module is registered by this line.

modify it to js_init_module_os(ctx, "qjs:os\0".as_ptr() as *const i8); just ok.

@Puellaquae
Copy link
Contributor Author

I rebase my branch to latest main, rename nodeos.js to os.js, and re-export qjs:os in os.js.

@L-jasmine L-jasmine merged commit 7161fe6 into second-state:main Jul 7, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants