GlobalsInterface

GlobalsInterface

Interface for methods to interact with the filesystem and HDF5 files. Applications are expected to implement each of the documented methods.

Methods

clean(x) → {undefined|Promise.<undefined>}

Source:
Parameters:
Name Type Description
x string | Uint8Array

Return value of get.

Returns:

Any resources used by get to return x can be freed. For example, if x is a path referring to a temporary file, it can be removed. No value is returned, though the method may be asynchronous.

Type
undefined | Promise.<undefined>

copy(from, to) → {undefined|Promise.<undefined>}

Source:
Parameters:
Name Type Description
from string

Local path to a file to be copied, see get for details.

to string

Local path to the new location of the file, see get for details.

Returns:

The contents of from are copied to to. No value is returned, though the method may be asynchronous.

Type
undefined | Promise.<undefined>

exists(path) → {boolean|Promise.<boolean>}

Source:
Parameters:
Name Type Description
path string

Local path to a file, see get for details. Note that this should not be a path to a directory; developers of readObject functions should check for the existence of particular files inside a directory, rather than the directory itself.

Returns:

Whether the path exists.

Type
boolean | Promise.<boolean>

get(path, optionsopt) → {Uint8Array|string|Promise.<(Uint8Array|string)>}

Source:
Parameters:
Name Type Attributes Default Description
path string

Local path to a file. This should lie inside some application-specific concept of a directory, even if a local filesystem does not exist (e.g., an S3 bucket, or a Zip archive).

options object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
asBuffer boolean <optional>
false

Whether to return the file contents as a Uint8Array.

Returns:

Relative or absolute path to the file on the local filesystem. If asBuffer = true or if no local filesystem is available, a Uint8Array of the file contents is returned instead. A promise of a string or Uint8Array may also be returned.

Callers should pass the (Promise-resolved) return value to clean once the file is no longer required.

Type
Uint8Array | string | Promise.<(Uint8Array|string)>

h5close(handle) → {undefined|Promise.<undefined>}

Source:
Parameters:
Name Type Description
handle H5Group

Return value of h5open. This will already have its close method invoked.

Returns:

This should execute clean-up operations when the file used in h5open is no longer needed. No value is returned, possibly asynchronously.

Type
undefined | Promise.<undefined>

h5create(path) → {H5Group|Promise.<H5Group>}

Source:
Parameters:
Name Type Description
path string

Local path to a HDF5 file to be created. As with get, the path may refer to a file not on the local filesystem, e.g., on a remote server, inside an archive file.

Returns:

A read-write handle to a new HDF5 file, or a promise thereof. This may refer to, e.g., a temporary file in a virtual filesystem, if no local filesystem exists.

Type
H5Group | Promise.<H5Group>

h5finish(handle, failed) → {Uint8Array|Promise.<?Uint8Array>}

Source:
Parameters:
Name Type Description
handle H5Group

Return value of h5create. This will already have its close method invoked.

failed boolean

Whether an error occurred when writing to the HDF5 file.

Returns:

This should execute clean-up operations when no more write operations are to be performed on the file returned by h5create. If failed = true, any existing resources associated with the file may be deleted, and null should be returned, possibly asynchronously.

Type
Uint8Array | Promise.<?Uint8Array>

h5open(path) → {H5Group|Promise.<H5Group>}

Source:
Parameters:
Name Type Description
path string

Local path to a HDF5 file. As with get, the path may refer to a file not on the local filesystem, e.g., on a remote server, inside an archive file.

Returns:

A read-only handle to the HDF5 file, or a promise thereof.

Type
H5Group | Promise.<H5Group>

mkdir(path) → {undefined|Promise.<undefined>}

Source:
Parameters:
Name Type Description
path string

Local path to a directory. As with get, the path may refer to a directory not on the local filesystem, e.g., on a remote server, inside an archive file. It is assumed that all parent directories have already been created.

Returns:

A new directory is created at path. (This may be a no-op if the application does not support creation of directories.) No value is returned, though the method may be asynchronous.

Type
undefined | Promise.<undefined>

write(path, contents) → {undefined|Promise.<undefined>}

Source:
Parameters:
Name Type Description
path string

Local path to a file, see get for details.

contents Uint8Array

Contents of the file.

Returns:

contents is stored at path. The exact nature of this storage depends on the application - it may involve saving a file to the local filesystem, or uploading a file to a server, etc. If path already exists, it should be overwritten with contents. No value is returned, though the method may be asynchronous.

Type
undefined | Promise.<undefined>