Skip to content

Align Flow lib defs for Node.js buffer with v24#55017

Closed
robhogan wants to merge 1 commit into
mainfrom
export-D89942832
Closed

Align Flow lib defs for Node.js buffer with v24#55017
robhogan wants to merge 1 commit into
mainfrom
export-D89942832

Conversation

@robhogan

@robhogan robhogan commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

Summary:
This is an AI-assisted change to align the Flow definitions for the buffer module with the Node.js docs as at v24.

New Validation Functions:

  1. isUtf8(input) - UTF-8 validation (added in v19.4.0, v18.14.0)

  2. isAscii(input) - ASCII validation (added in v19.6.0, v18.15.0)

Blob URL Resolution:

  1. resolveObjectURL(id) - Resolve Blob from URL (added in v16.7.0)

New Constants:

  1. constants object - Buffer size limits

Web API Classes (re-exported):

  1. Blob class - Exported from buffer module (global in v18.0.0)

  2. File class - Exported from buffer module (global in v20.0.0)

References:

Changelog: [Internal]

Generated by Confucius Code Assist (CCA)
Confucius Session, Trace

Reviewed By: vzaidman

Differential Revision: D89942832

Summary:
This is an AI-assisted change to align the Flow definitions for the `buffer` module with the Node.js docs as at v24.

**New Validation Functions:**

1. **`isUtf8(input)`** - UTF-8 validation (added in v19.4.0, v18.14.0)
   - Validates if Buffer/ArrayBuffer/TypedArray contains only valid UTF-8 data
   - Returns `true` for valid UTF-8 (including empty buffers)
   - Throws error if input is a detached array buffer
   - https://nodejs.org/api/buffer.html#bufferisutf8input

2. **`isAscii(input)`** - ASCII validation (added in v19.6.0, v18.15.0)
   - Validates if Buffer/ArrayBuffer/TypedArray contains only ASCII (0x00-0x7F)
   - Returns `true` for valid ASCII (including empty buffers)
   - Throws error if input is a detached array buffer
   - https://nodejs.org/api/buffer.html#bufferisasciiinput

**Blob URL Resolution:**

3. **`resolveObjectURL(id)`** - Resolve Blob from URL (added in v16.7.0)
   - Resolves `'blob:nodedata:...'` URL to its associated Blob object
   - Returns Blob or `undefined` if URL not found
   - Works with URLs created via `URL.createObjectURL(blob)`
   - https://nodejs.org/api/buffer.html#bufferresolveobjecturlid

**New Constants:**

4. **`constants` object** - Buffer size limits
   - `constants.MAX_LENGTH` - Maximum size of a single Buffer instance
   - `constants.MAX_STRING_LENGTH` - Maximum length for string operations
   - https://nodejs.org/api/buffer.html#bufferconstantsmax_length

**Web API Classes (re-exported):**

5. **`Blob` class** - Exported from buffer module (global in v18.0.0)
   - Web API-compatible Blob for immutable binary data
   - Also available as global (no import needed in v18+)
   - https://nodejs.org/api/buffer.html#class-blob

6. **`File` class** - Exported from buffer module (global in v20.0.0)
   - Web API-compatible File extending Blob
   - Also available as global (no import needed in v20+)
   - https://nodejs.org/api/buffer.html#class-file

**References:**
- Node.js buffer module docs: https://nodejs.org/api/buffer.html

Changelog: [Internal]
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace)

Reviewed By: vzaidman

Differential Revision: D89942832
@meta-codesync

meta-codesync Bot commented Jan 2, 2026

Copy link
Copy Markdown

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D89942832.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 2, 2026
meta-codesync Bot pushed a commit to react/metro that referenced this pull request Jan 2, 2026
Summary:
X-link: react/react-native#55017

This is an AI-assisted change to align the Flow definitions for the `buffer` module with the Node.js docs as at v24.

**New Validation Functions:**

1. **`isUtf8(input)`** - UTF-8 validation (added in v19.4.0, v18.14.0)
   - Validates if Buffer/ArrayBuffer/TypedArray contains only valid UTF-8 data
   - Returns `true` for valid UTF-8 (including empty buffers)
   - Throws error if input is a detached array buffer
   - https://nodejs.org/api/buffer.html#bufferisutf8input

2. **`isAscii(input)`** - ASCII validation (added in v19.6.0, v18.15.0)
   - Validates if Buffer/ArrayBuffer/TypedArray contains only ASCII (0x00-0x7F)
   - Returns `true` for valid ASCII (including empty buffers)
   - Throws error if input is a detached array buffer
   - https://nodejs.org/api/buffer.html#bufferisasciiinput

**Blob URL Resolution:**

3. **`resolveObjectURL(id)`** - Resolve Blob from URL (added in v16.7.0)
   - Resolves `'blob:nodedata:...'` URL to its associated Blob object
   - Returns Blob or `undefined` if URL not found
   - Works with URLs created via `URL.createObjectURL(blob)`
   - https://nodejs.org/api/buffer.html#bufferresolveobjecturlid

**New Constants:**

4. **`constants` object** - Buffer size limits
   - `constants.MAX_LENGTH` - Maximum size of a single Buffer instance
   - `constants.MAX_STRING_LENGTH` - Maximum length for string operations
   - https://nodejs.org/api/buffer.html#bufferconstantsmax_length

**Web API Classes (re-exported):**

5. **`Blob` class** - Exported from buffer module (global in v18.0.0)
   - Web API-compatible Blob for immutable binary data
   - Also available as global (no import needed in v18+)
   - https://nodejs.org/api/buffer.html#class-blob

6. **`File` class** - Exported from buffer module (global in v20.0.0)
   - Web API-compatible File extending Blob
   - Also available as global (no import needed in v20+)
   - https://nodejs.org/api/buffer.html#class-file

**References:**
- Node.js buffer module docs: https://nodejs.org/api/buffer.html

Changelog: [Internal]
 ---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace)

Reviewed By: vzaidman

Differential Revision: D89942832

fbshipit-source-id: 2b86a3084649674f43b6e0a08f9bbf0affd680f9
@meta-codesync meta-codesync Bot closed this in 4862cc7 Jan 2, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 2, 2026
@meta-codesync

meta-codesync Bot commented Jan 2, 2026

Copy link
Copy Markdown

This pull request has been merged in 4862cc7.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @robhogan in 4862cc7

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants