# node:os

The `node:os` module provides operating system utility functions and properties, as the [Node.js os documentation](https://nodejs.org/api/os.html) describes. In Azion Runtime, `import os from "node:os"` builds, and every member listed below works without throwing, in a deployed function and under `azion dev`.

The values are the same in both environments, so they do not identify the machine that runs your code. `os.platform()` returns `linux` and `os.type()` returns `Linux`. `os.homedir()` returns `/`, `os.tmpdir()` returns `/tmp`, `os.endianness()` returns `LE`, and `os.EOL` is `\n`. `os.arch()`, `os.release()`, `os.hostname()`, `os.machine()`, and `os.version()` return an empty string, and `os.totalmem()`, `os.freemem()`, and `os.uptime()` return `0`. `os.availableParallelism()` returns `8`, `os.cpus()` returns 8 entries, and `os.networkInterfaces()` lists one interface, `lo0`.

---

## Example

The function below reads the platform name, logs it, and returns it in the response body:

```javascript
/**
 * An example of using the Node.js OS API in an Azion Function.
 * @example
 * // Build and run locally with the Azion CLI:
 * azion build
 * azion dev
 */
import os from "node:os";

/**
 * An example of using the Node.js OS API in an Azion Function.
 * @param {*} event
 * @returns Promise<Response>
 */
const main = async (event) => {
  return new Promise((resolve, reject) => {
    const platform = os.platform();
    console.log("Platform", platform);
    resolve(new Response(`platform: ${platform}`));
  });
};

export default main;
```

The function logs `Platform linux` and responds with this body:

```text
platform: linux
```

---

## Related resources

- [Node.js APIs](/en/documentation/devtools/runtime/node.md): Every Node.js module Azion Runtime resolves, and how each one behaves.
- [node:process](/en/documentation/devtools/runtime/node/process.md): The process object, whose platform and architecture properties are also empty.
- [Use Node.js APIs through polyfills](/en/documentation/guides/application-development/functions-and-runtime/use-polyfills.md): How the build resolves Node.js APIs through polyfills, shown in a JavaScript project.
- [Handlers](/en/documentation/devtools/runtime/api-reference/handlers.md): The recommended handler shape, and the notice `azion build` prints for the `export default main` shape this sample uses.
