## Classes
A collection of data files with optional metadata. Under the hood it heavily uses Data Package formats and it natively supports Data Package formats including loading from datapackage.json files.
A Dataset has four primary properties: descriptor: key metadata. The descriptor follows the Data Package spec resources: an array of the Files contained in this Dataset identifier: the identifier encapsulates the location (or origin) of this Dataset readme: the README for this Dataset (if it exists).
Abstract Base instance of File
Parse a data source path into a descriptor object. The descriptor should follow the Frictionless Data Resource model http://specs.frictionlessdata.io/data-resource/
Checks if path os a URL
Checks if path is a Dataset package. Dateset follows the Frictionless Data Resource model
Load a file from a path or descriptor. Files source supported are local, remote or inline data.
Computes the streaming hash of a file
string | Data source. Can be a url or local file path |
| basePath | string | Base path to data source |
| format | string | format of the data. |
## parseDatasetIdentifier
**Kind**: global constant
| Param | Type | Description |
| --- | --- | --- |
| path_ | string | Data source. Can be a url or local file path |
## isUrl
Checks if path os a URL
**Kind**: global constant
| Param | Type | Description |
| --- | --- | --- |
| path_ | string | Data source. Can be a url or local file path |
## isDataset
Checks if path is a Dataset package. Dateset follows the Frictionless Data Resource model
**Kind**: global constant
| Param | Type | Description |
| --- | --- | --- |
| path_ | string | Data source. Can be a url or local file path |
## open(pathOrDescriptor, options)
Load a file from a path or descriptor. Files source supported are
local, remote or inline data.
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| pathOrDescriptor | array | A source to load data from. Can be a local or remote file path, can be a raw data object with the format: { name: 'mydata', data: { // can be any javascript object, array or string a: 1, b: 2 } } Files can also be loaded with a descriptor object. This allows more fine-grained configuration. The descriptor should follow the Frictionless Data Resource model http://specs.frictionlessdata.io/data-resource/ { file or url path path: 'https://example.com/data.csv', // a Table Schema - https://specs.frictionlessdata.io/table-schema/ schema: { fields: [ ... ] } // CSV dialect - https://specs.frictionlessdata.io/csv-dialect/ dialect: { // this is tab separated CSV/DSV delimiter: '\t' } } |
| options | object | { basePath, format } Use basepath in cases where you want to create a File with a path that is relative to a base directory / path e.g: const file = data.open('data.csv', {basePath: '/my/base/path'}) |
## computeHash(fileStream, fileSize, algorithm, progress)
Computes the streaming hash of a file
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| fileStream | object | A node like stream |
| fileSize | number | Total size of the file |
| algorithm | string | sha256/md5 hashing algorithm to use |
| progress | func | Callback function with progress |