Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WAKBlobInstance

Hierarchy

Index

Properties

Methods

Properties

size

size: number

Size of the Blob in bytes.

type

type: string

Media type of the Blob expressed as MIME or "" if unknown.

Methods

copyTo

  • copyTo(destination: String, overwrite?: Boolean): void
  • copyTo(destination: WAKFileInstance, overwrite?: Boolean): void
  • Copies the blob into a file.

    Example 1: Copy a blob

    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 );

    Example 2: Copy a file

    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 );

    Parameters

    • destination: String

      Destination file

    • Optional overwrite: Boolean

      true to override existing file if any, false otherwise

    Returns void

  • Parameters

    Returns void

slice

  • Creates a new blob by referencing the binary contents of the File to which it is applied, from start to end.

    Example 1: Slice a blob

    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

    Example 2: Slice a blob

    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

    Example 3: Slice a file

    var myFile = new File( 'PROJECT/bootstrap.js' );
    var myBlobSlice = myFile.slice( 0, 100 );
    console.log( myBlobSlice.toString() );

    Parameters

    • Optional start: Number

      (default: 0)

    • Optional end: Number

      (default: blob.size)

    • Optional mimeType: String

    Returns WAKBlobInstance

toBuffer

toString

  • toString(stringFormat?: String): String
  • Get a string representation of the blob contents.

    Parameters

    • Optional stringFormat: String

    Returns String