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

doc: clarify Web Storage behavior #54637

Closed
wants to merge 5 commits into from

Conversation

jmsb02
Copy link
Contributor

@jmsb02 jmsb02 commented Aug 29, 2024

Title

doc: clarify Web Storage behavior and document --localstorage-file option

Description

### Issue Resolved
This pull request addresses the issue outlined in [#53871](https://github.com/nodejs/node/issues/53871). The changes clarify the Web Storage behavior in Node.js and document the `--localstorage-file` option.

### Changes Made
1. **cli.md**: Added documentation for the `--localstorage-file` option.
   - Placed after the `--max-old-space-size` section.
   - Described how to use the `--localstorage-file` option to specify the file used for `localStorage` in Node.js.
   - Mentioned key considerations such as the possibility of concurrent access by multiple processes and the 10MB storage quota per process.

   Example documentation snippet added:
   ```markdown
   ### --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.
  1. globals.md: Added a new section describing how localStorage and sessionStorage behave in Node.js.

    • Clarified that both are scoped to the current process.
    • Explained that the --localstorage-file flag determines the file used for localStorage.
    • Reiterated the 10MB per process storage quota.

    Example documentation snippet added:

    ## 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.

Note

  • The --localstorage-file option is currently documented but not implemented in the Node.js core. Therefore, the added documentation is primarily for reference and future-proofing.
  • No new tests have been included, as this PR only addresses documentation changes.
    -- I feel that my contributions are still lacking, and I appreciate any feedback you may have to help me improve. Thank you for your understanding:)

Please review the documentation updates, and let me know if there are any additional changes or clarifications needed.


@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Aug 29, 2024
@RedYetiDev RedYetiDev closed this Aug 29, 2024
@RedYetiDev RedYetiDev added invalid Issues and PRs that are invalid. and removed buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Aug 29, 2024
@RedYetiDev
Copy link
Member

RedYetiDev commented Aug 29, 2024

As it currently stands, this PR appears to be invalid. The PR commit, title, and description all appear to be referencing something else.

Additionally, this is a duplicate (content-wise) of your other PR, #54114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issues and PRs that are invalid.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants