true
if the file exists at the defined path, false
otherwise.
File extension.
Last modification date for the file if any.
Name of the file with the extension and without the path.
Name of the file without the extension.
Parent folder of the file.
Full path of the file.
true
if the file is read only, false
otherwise.
Size of the Blob in bytes.
Media type of the Blob expressed as MIME or "" if unknown.
true
if the file is visible, false
otherwise.
Copies the blob into a file.
var myBlob = new Blob( 20 );
myBlob.copyTo( 'PROJECT/blob_copy.js' );
or
var myFile = new File( 'PROJECT/blob_copy.js' );
var myBlob = new Blob( 20 );
myBlob.copyTo( myFile );
var myFile = new File( 'PROJECT/bootstrap.js' );
myFile.copyTo( 'PROJECT/bootstrap_copy.js' );
or
var myFile = new File( 'PROJECT/bootstrap.js' );
var myFileCopy = new File( 'PROJECT/bootstrap_copy.js' );
myFile.copyTo( myFileCopy );
Destination file
true
to override existing file if any, false
otherwise
Creates a new file on disk.
var myFile = new File( 'PROJECT/my-created-file.js' );
var myResult = myFile.create();
console.log( myResult );
// true
true
if the file is well created
Returns the size of the free space (expressed in bytes) available on the volume where the File object is stored.
(default: true
) true
if consider the whole volume, false
if consider only the allowed size for the quota
Returns the absolute URL of the File object.
(default: false
) true
if encode the url, false
otherwise.
Returns the total size (expressed in bytes) of the volume where the File object is stored.
Moves the file to the specified destination.
var myFile = new File( 'PROJECT/my-file.js' );
myFile.create();
myFile.moveTo( 'PROJECT/my-moved-file.js', yes );
// myFile always references the "my-file.js" file
// The referenced file did not change with the moveTo() action.
console.log( myFile.path );
Destination file path
true
if the file can be overwritten, false
otherwise
Moves the file to the specified destination.
var mySourceFile = new File( 'PROJECT/my-file.js' );
var myDestinationFile = new File( 'PROJECT/my-moved-file.js' );
// The file must exists to be renamed
myFile.create();
myFile.moveTo( myDestinationFile, yes );
// myFile always references the "my-file.js" file
// The referenced file did not change with the moveTo() action.
console.log( myFile.path );
// PROJECT/my-file.js
Destination file path
true
if the file can be overwritten, false
otherwise
Removes the file from the disk.
true
if the file is removed from disk, false
otherwise.
Rename the file on disk.
var myFile = new File( 'PROJECT/my-file.js' );
// The file must exists to be renamed
myFile.create();
// The destination file name must be free
myFile.setName( 'my-renamed-file.js' );
// myFile always references the "my-file.js" file
// The referenced file did not change with the setName() action.
console.log( myFile.path );
// PROJECT/my-file.js
New file name
true
if the file is successfully renamed
Creates a new blob by referencing the binary contents of the File to which it is applied, from start to end.
var myBlob = new Blob( 20 , 88, 'application/octet-stream' );
console.log( myBlob.toString() );
// XXXXXXXXXXXXXXXXXXXX
var mySlicedBlob = myBlob.slice( 5, 10 );
console.log( mySlicedBlob.toString() );
// XXXXX
var myBlob = new Blob( 20 , 88, 'application/octet-stream' );
console.log( myBlob.toString() );
// XXXXXXXXXXXXXXXXXXXX
var mySlicedBlob = myBlob.slice( 0, -5 );
console.log( mySlicedBlob.toString() );
// XXXXXXXXXXXXXXX
var myFile = new File( 'PROJECT/bootstrap.js' );
var myBlobSlice = myFile.slice( 0, 100 );
console.log( myBlobSlice.toString() );
(default: 0)
(default: blob.size)
Returns a buffer object containing a copy of the File bytes.
Get a string representation of the blob contents.
Creation date for the file.