Index

File

MMO.core · 1 symbol · generated 5 Oct 2026

class

File

File.js:6
class MMO.core.File
Namespace
MMO.core

Index

size readonly accessor
extension readonly accessor
name readonly accessor
basename readonly accessorGet name without extension
constructor(file, progressFn, chunkSize)
getSize(decimals)Get size as a string with units
toString()
onProgress(e)[internal] FileReader progress handler: converts the CHUNK's progress into a percentage of the whole file, then forwards it to the callback given to the constructor.
isSent()
send(url, data, opts)Send the file in chunks to the given url The data sent follow this format: ```json { "name": {string},//the file's name "type": {string},//the file's type "size": {integer},//the file's size "offse…

Properties4

size

readonlyaccessorFile.js:24
get size()
Type
number

extension

readonlyaccessorFile.js:37
get extension()
Type
string

name

readonlyaccessorFile.js:42
get name()
Type
string

basename

readonlyaccessorFile.js:50

Get name without extension

get basename()

Methods6

constructor(file, progressFn, chunkSize)

File.js:7
constructor(file, progressFn, chunkSize = 2000 * 1024)
file
progressFn
chunkSize = 2000 * 1024

getSize(decimals)

File.js:32

Get size as a string with units

getSize(decimals = 2)
decimals = 2
returns

toString()

File.js:55
toString()
returnsstringMMO.core.File#name

onProgress(e)

File.js:64

[internal] FileReader progress handler: converts the CHUNK's progress into a percentage of the whole file, then forwards it to the callback given to the constructor.

onProgress(e)
eProgressEvent

isSent()

File.js:103
isSent()
returnsbooleantrue once the server has acknowledged at least one chunk

send(url, data, opts)

File.js:139
Send the file in chunks to the given url The data sent follow this format: ```json { "name": {string},//the file's name "type": {string},//the file's type "size": {integer},//the file's size "offset": {integer},//the chunk's offset "data": {string},//a chunk of the file's data "last": {boolean},//true if this is the last chunk "filename": {string},//the file's filename for the server (available only from the second chunk, after receiving a response from the server. it is in the response `file.filename`) } ```send(url, data = {}, opts = {})The response MUST follow this format: ```json { "success" : 1, "file": { "url" : "...",//the file url "filename": "...",//the file absolute filename // ... and any additional fields you want to store, such as width, height, color, extension, etc } } ```
url
data = {}
opts = {}
returnsPromise<MMO.core.File>