<commit_before># vega-loader

Network request and file loading utilities.

## API Reference

* [File Loading](#file-loading)
* [Data Format Parsing](#data-format-parsing)

### File Loading

<a name="loader" href="#loader">#</a>
vega.<b>loader</b>([<i>options</i>])
[<>](https://github.com/vega/vega-loader/blob/master/src/loader.js "Source")

Creates a new loader instance with default *options*. A loader object
provides methods for loading files from the network or disk, and for sanitizing
requested URLs and filenames. If provided, the key-value pairs in the *options*
object will be passed as default options to the various loader methods.

The *options* object can include the following entries:
- *baseURL*: A base URL prefix to append to provided *uri* values. This can
be useful for applications that load multiple data sets from the same domain.
- *mode*: A string explicitly indicating the loading mode. One of `'file'`
(server-side only) or `'http'`. If set to `'file'` mode, later *uri* parameters
may safely omit a `'file://'` prefix.
- *defaultProtocol*: The default protocol to use for protocol-relative *uri*
values (e.g., `'//vega.github.io'`). Defaults to `'http'`.
- *target*: The browser target attribute for hyperlinks. Only applies when sanitizing *uri* values for use as a hyperlink.
- *headers*: An object of key-values indicating custom request headers, used
only when loading via HTTP.

<a name="load" href="#load">#</a>
loader.<b>load</b>(<i>uri</i>[, <i>options</i>])
[<>](https://github.com/vega/vega-loader/blob/master/src/load.js "Source")

Loads a file from either the network or disk, and returns a
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
for asyncronously accessing the loaded content. This method does not perform
any parsing, it simply returns the loaded data as either a Buffer or String
instance, depending on the execution environment. To subsequently parse loaded
data, use the [read](#read) method.

The *uri* argument is a value indicating the file to load. This is typically<commit_msg>Fix a broken link<commit_after># vega-loader

Network request and file loading utilities.

## API Reference

* [File Loading](#file-loading)
* [Data Format Parsing](#data-format-parsing)

### File Loading

<a name="loader" href="#loader">#</a>
vega.<b>loader</b>([<i>options</i>])
[<>](https://github.com/vega/vega-loader/blob/master/src/loader.js "Source")

Creates a new loader instance with default *options*. A loader object
provides methods for loading files from the network or disk, and for sanitizing
requested URLs and filenames. If provided, the key-value pairs in the *options*
object will be passed as default options to the various loader methods.

The *options* object can include the following entries:
- *baseURL*: A base URL prefix to append to provided *uri* values. This can
be useful for applications that load multiple data sets from the same domain.
- *mode*: A string explicitly indicating the loading mode. One of `'file'`
(server-side only) or `'http'`. If set to `'file'` mode, later *uri* parameters
may safely omit a `'file://'` prefix.
- *defaultProtocol*: The default protocol to use for protocol-relative *uri*
values (e.g., `'//vega.github.io'`). Defaults to `'http'`.
- *target*: The browser target attribute for hyperlinks. Only applies when sanitizing *uri* values for use as a hyperlink.
- *headers*: An object of key-values indicating custom request headers, used
only when loading via HTTP.

<a name="load" href="#load">#</a>
loader.<b>load</b>(<i>uri</i>[, <i>options</i>])
[<>](https://github.com/vega/vega-loader/blob/master/src/loader.js "Source")

Loads a file from either the network or disk, and returns a
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
for asyncronously accessing the loaded content. This method does not perform
any parsing, it simply returns the loaded data as either a Buffer or String
instance, depending on the execution environment. To subsequently parse loaded
data, use the [read](#read) method.

The *uri* argument is a value indicating the file to load. This is typically
{'fraction_non_alphanumeric': 0.12135690396559962, 'fraction_numerical': 0.0, 'mean_word_length': 4.847765363128492, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5371184', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1187, 'n_words': 514}