Skip to content

Commit

Permalink
buffer: graduate File from experimental and expose as global
Browse files Browse the repository at this point in the history
PR-URL: #47153
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
KhafraDev authored Mar 22, 2023
1 parent 202a9fa commit 7bc0e6a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
6 changes: 4 additions & 2 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5054,10 +5054,12 @@ See [`Buffer.from(string[, encoding])`][`Buffer.from(string)`].
added:
- v19.2.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}

A [`File`][] provides information about files.
Expand Down
10 changes: 10 additions & 0 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ changes:
A browser-compatible implementation of the [`fetch()`][] function.

## Class: `File`

<!-- YAML
added: REPLACEME
-->

<!-- type=global -->

See {File}.

## Class `FormData`

<!-- YAML
Expand Down
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ rules:
message: Use `const { Event } = require('internal/event_target');` instead of the global.
- name: EventTarget
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
message: Use `const { FormData } = require('internal/deps/undici/undici');` instead of the global.
- name: Headers
Expand Down
2 changes: 2 additions & 0 deletions lib/internal/bootstrap/web/exposed-window-or-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ exposeLazyInterfaces(globalThis, 'internal/worker/io', [
defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']);
// https://www.w3.org/TR/FileAPI/#dfn-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
exposeLazyInterfaces(globalThis, 'perf_hooks', [
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure',
Expand Down
3 changes: 0 additions & 3 deletions lib/internal/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const {

const {
customInspectSymbol: kInspect,
emitExperimentalWarning,
kEnumerableProperty,
kEmptyObject,
toUSVString,
Expand All @@ -37,8 +36,6 @@ class File extends Blob {
#lastModified;

constructor(fileBits, fileName, options = kEmptyObject) {
emitExperimentalWarning('buffer.File');

if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('fileBits', 'fileName');
}
Expand Down

0 comments on commit 7bc0e6a

Please sign in to comment.