The FileLoader.setMimeType() method is used to set the MIME type of the file that is being loaded using the FileLoader in three.js. The MIME type is a string that specifies the format of the data that is being transferred between the server and the client.
loader.setMimeType( mimeType )
mimeType : A string value that represents the MIME type of the file that you are loading.var loader = new THREE.FileLoader();
// Set the MIME type of the file that we are loading
loader.setMimeType( "application/json" );
// Load the file using the loader
loader.load(
// resource URL
'myfile.json',
// onLoad callback
function ( data ) {
// Do something with the loaded data
console.log( data );
}
);
In this example, we first create a new FileLoader object. We then use the setMimeType() method to set the MIME type of the file that we want to load to "application/json". Finally, we use the load() method of the FileLoader to load the file.
three.js are "image/jpeg", "image/png", "image/gif", "audio/mp3", "audio/wav", "video/mp4", "application/json", "text/plain", etc.