Reads all the bytes of a File or Blob into an ArrayBuffer, the form binary loaders and the STEP converters take.
The File or Blob to read
The bytes as an ArrayBuffer
Reads all the bytes of a File or Blob into a Uint8Array, a byte array that can be indexed and sliced.
The File or Blob to read
The bytes as a Uint8Array
Wraps a Blob in a File with a name and a MIME type, which loaders that want a file name need;
the Blob's own type is kept when mimeType is left out.
The Blob, the file name and the optional MIME type
The File
Copies the bytes of a File into a plain Blob of the same type, dropping the name; a Blob given in comes back as a copy.
The File or Blob to copy
The Blob
Views the bytes of an ArrayBuffer as a Uint8Array; no bytes are copied, both share the same memory.
The ArrayBuffer to view
The Uint8Array over the same bytes
Copies exactly the bytes a Uint8Array covers into a new ArrayBuffer, so a view over part of a larger buffer gives only its own part.
The Uint8Array to copy
The new ArrayBuffer
Makes a temporary URL for a File or Blob held in memory, so it can be handed to anything that loads from a URL, such as a texture or a model loader.
The URL lives as long as the page does.
The File or Blob
The temporary URL
Makes a temporary URL for each File or Blob in a list, in the same order, as
createObjectURL does for one.
The Files or Blobs
One temporary URL per file, in the same order
Starts a browser download of the given content as a file named fileName plus the
extension.
Text content is wrapped in a Blob of the contentType; a Blob is downloaded as it is.
The file name, the content, the extension and the content type
Downloads the content at a URL as a Blob, raw bytes without a file name; the server must allow cross-origin requests.
The URL to fetch
The response body as a Blob
Downloads the content at a URL as a File named after the last part of the URL, without its query string; the server must allow cross-origin requests.
The URL to fetch
The response body as a File
Downloads the content at a URL and parses it as JSON; the server must allow cross-origin requests and the body must be valid JSON.
The URL to fetch
The parsed JSON value
Downloads the content at a URL as plain text; the server must allow cross-origin requests.
The URL to fetch
The response body as text
Loads a named asset of the running application as a File, through the lookup the application
supplies in assetManager.getAsset.
Which store the name is looked up in depends on the application; a missing asset rejects the promise.
The asset's file name
The asset as a File
Loads a named asset of the running application and reads it as text, for JSON, CSV or other text files stored as assets.
The asset's file name
The asset's content as text
Loads a named local asset, one kept in the browser rather than on a server, through the
lookup the application supplies in assetManager.getLocalAsset.
A name that resolves to several files gives a list.
The asset's file name
The asset as a File, or a list of Files when the name holds several
Loads a named local asset, one kept in the browser rather than on a server, and reads it as text; a name that resolves to several files gives a list of texts.
The asset's file name
The content as text, or a list of texts when the name holds several files
Files in and out of a script: assets the running application stores under a name, files fetched from a URL, downloads, and conversions between File, Blob, ArrayBuffer and Uint8Array. The application supplies the lookups through
assetManager, so what an asset name resolves to depends on where the script runs; fetching needs an endpoint that allows cross-origin requests.