Class: File

File

A base class for local file or buffer readers.


new File()

Source:
bu/format/localfile.js

Extends

  • ol.Object

Methods


createVectorSources(name, data)

Returns a Promise that creates an array of source.

Parameters:
Name Type Description
name string

Name for the source.

data Object | string

Input content.

Source:
bu/format/localfile.js
Returns:

A Promise that returns an array of source created using the input for the resolve function and an Error for the reject function.

Type
Promise

getFeatures(content)

Returns an array of ol.Feature processing the input content. Depending on the current internal format reader, content can be different inputs. For example, for GeoJSON content can be a string with the json or the json object.

Parameters:
Name Type Description
content Object | string

Input content.

Source:
bu/format/localfile.js
Returns:
Type
Array.<ol.Feature>

<abstract> getProjectionInfo(content)

Returns a bu.ProjectionInfo from the content. Depending on the current internal format reader, content can be different inputs. For example, for GeoJSON content can be a string with the json or the json object. For other formats overwrite this function.

Parameters:
Name Type Description
content Object | string

Input content.

Source:
bu/format/localfile.js
Returns:

Projection info with nullable code.

Type
bu.ProjectionInfo

read(input)

Returns a Promise that creates an array of source.

Parameters:
Name Type Description
input File | string | Object | Buffer | ArrayBuffer

Input content. It can be a File, a string, an object, a Buffer or an ArrayBuffer.

Source:
bu/format/localfile.js
Returns:

A Promise that returns an array of source for the resolve function and an Error for the reject function.

Type
Promise

readFile(file, asText)

Returns a Promise that reads a file and returns its content.

Parameters:
Name Type Description
file File

File to read.

asText boolean

If read file as text or as an array buffer.

Source:
bu/format/localfile.js
Returns:

A Promise that returns a string with the content of the file for the resolve function and an Error for the reject function.

Type
Promise