buffer: graduate File from experimental and expose as global

PR-URL: https://github.com/nodejs/node/pull/47153
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Khafra 2023-03-22 15:28:12 -04:00 committed by GitHub
parent 202a9fa482
commit 7bc0e6a4e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 5 deletions

View file

@ -5054,10 +5054,12 @@ See [`Buffer.from(string[, encoding])`][`Buffer.from(string)`].
added: added:
- v19.2.0 - v19.2.0
- v18.13.0 - v18.13.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/47153
description: No longer experimental.
--> -->
> Stability: 1 - Experimental
* Extends: {Blob} * Extends: {Blob}
A [`File`][] provides information about files. A [`File`][] provides information about files.

View file

@ -474,6 +474,16 @@ changes:
A browser-compatible implementation of the [`fetch()`][] function. A browser-compatible implementation of the [`fetch()`][] function.
## Class: `File`
<!-- YAML
added: REPLACEME
-->
<!-- type=global -->
See {File}.
## Class `FormData` ## Class `FormData`
<!-- YAML <!-- YAML

View file

@ -59,6 +59,8 @@ rules:
message: Use `const { Event } = require('internal/event_target');` instead of the global. message: Use `const { Event } = require('internal/event_target');` instead of the global.
- name: EventTarget - name: EventTarget
message: Use `const { EventTarget } = require('internal/event_target');` instead of the global. message: Use `const { EventTarget } = require('internal/event_target');` instead of the global.
- name: File
message: Use `const { File } = require('buffer');` instead of the global.
- name: FormData - name: FormData
message: Use `const { FormData } = require('internal/deps/undici/undici');` instead of the global. message: Use `const { FormData } = require('internal/deps/undici/undici');` instead of the global.
- name: Headers - name: Headers

View file

@ -34,6 +34,8 @@ exposeLazyInterfaces(globalThis, 'internal/worker/io', [
defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']); defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']);
// https://www.w3.org/TR/FileAPI/#dfn-Blob // https://www.w3.org/TR/FileAPI/#dfn-Blob
exposeLazyInterfaces(globalThis, 'internal/blob', ['Blob']); exposeLazyInterfaces(globalThis, 'internal/blob', ['Blob']);
// https://www.w3.org/TR/FileAPI/#dfn-file
exposeLazyInterfaces(globalThis, 'internal/file', ['File']);
// https://www.w3.org/TR/hr-time-2/#the-performance-attribute // https://www.w3.org/TR/hr-time-2/#the-performance-attribute
exposeLazyInterfaces(globalThis, 'perf_hooks', [ exposeLazyInterfaces(globalThis, 'perf_hooks', [
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure', 'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure',

View file

@ -13,7 +13,6 @@ const {
const { const {
customInspectSymbol: kInspect, customInspectSymbol: kInspect,
emitExperimentalWarning,
kEnumerableProperty, kEnumerableProperty,
kEmptyObject, kEmptyObject,
toUSVString, toUSVString,
@ -37,8 +36,6 @@ class File extends Blob {
#lastModified; #lastModified;
constructor(fileBits, fileName, options = kEmptyObject) { constructor(fileBits, fileName, options = kEmptyObject) {
emitExperimentalWarning('buffer.File');
if (arguments.length < 2) { if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('fileBits', 'fileName'); throw new ERR_MISSING_ARGS('fileBits', 'fileName');
} }