diff --git a/doc/api/cli.md b/doc/api/cli.md index ce34dee77ef300..45123ac284fde4 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -3385,6 +3385,15 @@ for MiB in 16 32 64 128; do done ``` +### --localstorage-file + +The --localstorage-file option specifies the file used for localStorage in Node.js. + +* This file can be accessed by multiple processes simultaneously, which + might require implementing file locking or other synchronization + mechanisms to ensure data integrity. +* The storage quota for `localStorage` is 10MB per process. + ### `--security-revert` ### `--stack-trace-limit=limit` diff --git a/doc/api/globals.md b/doc/api/globals.md index a559004d7e3842..16538d7d6b70d0 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -1199,6 +1199,20 @@ added: v18.0.0 A browser-compatible implementation of [`WritableStreamDefaultWriter`][]. +## Web Storage API + +In Node.js, the localStorage and sessionStorage objects function differently compared to browsers or Deno: + +* Both `localStorage` and `sessionStorage` are scoped to the current process, + not individual users or server requests. This is crucial for applications + like server-side rendering. +* `localStorage` uses the value of the `--localstorage-file` flag as its + origin. This file can be accessed simultaneously by multiple processes, + which may require implementing file locking or other synchronization + mechanisms to ensure data integrity. +* The storage quota for both `localStorage` and `sessionStorage` is + 10MB per process. + [CommonJS module]: modules.md [CommonJS modules]: modules.md [ECMAScript module]: esm.md