Back to Node Auth0

Type Alias WithMetadata

docs/types/management.Uploadable.WithMetadata.html

5.9.12.2 KB
Original Source

Type Alias WithMetadata

A file-like object with metadata, used for uploading files.

type WithMetadata = {
data: FileLike;
filename?: string;
contentType?: string;
contentLength?: number;
}

Index

Properties

datafilename?contentType?contentLength?

Properties

data

data: FileLike

The file data

Optionalfilename

filename?: string

Optional override for the file name (defaults to basename of path). This is used to set the Content-Disposition header in upload requests.

OptionalcontentType

contentType?: string

Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain'). This is used to set the Content-Type header in upload requests.

If not provided, the content type may be determined from the data itself.

  • If the data is a File, Blob, or similar, the content type will be determined from the file itself, if the type is set.
  • Any other data type will not have a content type set, and the upload request will use Content-Type: application/octet-stream instead.

OptionalcontentLength

contentLength?: number

Optional file size in bytes. The content length is used to set the Content-Length header in upload requests. If the content length is not provided and cannot be determined, the upload request will not include the Content-Length header, but will use Transfer-Encoding: chunked instead.

If not provided, the file size will be determined depending on the data type.

  • If the data is of type fs.ReadStream (createReadStream), the size will be determined from the file system.
  • If the data is a Buffer, ArrayBuffer, Uint8Array, Blob, File, or similar, the size will be determined from the data itself.
  • If the data is a Readable or ReadableStream, the size will not be determined.

Settings

Member Visibility

  • Protected
  • Inherited

ThemeOSLightDark

On This Page

Properties datafilenamecontentTypecontentLength