GetDataUrl (open)

Construct a data URL for a given file

Syntax

LOADLIB "wh::internet/urls.whlib";

STRING FUNCTION GetDataUrl(BLOB filedata, STRING filetype)

Parameters

BLOB filedata

The file contents

STRING filetype

The mime type. If not specified or not valid, it will be assumed to be a filename and used to help autodetect the mimetype

Return value

STRING

A data URL representing the given file

Description

This function creates a base64-encoded data URL for a file. For more information on data URL's, see Wikipedia: http://en.wikipedia.org/wiki/Data_URI or RFC 2397: http://tools.ietf.org/html/rfc2397