Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@loaders.gl/core
Advanced tools
The core API for working with loaders.gl loaders and writers
@loaders.gl/core is a framework-agnostic library for loading and processing data in various formats. It provides a unified API for handling different types of data sources, making it easier to work with complex data pipelines.
Loading Data
This feature allows you to load data from various sources using different loaders. In this example, the CSVLoader is used to load a CSV file from a URL.
const { load } = require('@loaders.gl/core');
const { CSVLoader } = require('@loaders.gl/csv');
async function loadData(url) {
const data = await load(url, CSVLoader);
console.log(data);
}
loadData('https://example.com/data.csv');
Parsing Data
This feature allows you to parse data from a string or buffer using different parsers. In this example, the JSONLoader is used to parse a JSON string.
const { parse } = require('@loaders.gl/core');
const { JSONLoader } = require('@loaders.gl/json');
async function parseData(jsonString) {
const data = await parse(jsonString, JSONLoader);
console.log(data);
}
parseData('{"key": "value"}');
Creating Custom Loaders
This feature allows you to create and register custom loaders for handling specific data formats. In this example, a CustomLoader is created and registered to load data from a custom format.
const { registerLoaders, Loader } = require('@loaders.gl/core');
class CustomLoader extends Loader {
parse(arrayBuffer) {
// Custom parsing logic
return { data: new Uint8Array(arrayBuffer) };
}
}
registerLoaders([new CustomLoader()]);
async function loadCustomData(url) {
const data = await load(url, CustomLoader);
console.log(data);
}
loadCustomData('https://example.com/data.custom');
PapaParse is a powerful CSV parser that can handle large files and various edge cases. It is specifically designed for parsing CSV data, whereas @loaders.gl/core provides a more general framework for loading and parsing multiple data formats.
Axios is a popular HTTP client for making requests to fetch data from URLs. While it focuses on making HTTP requests, @loaders.gl/core provides a higher-level abstraction for loading and parsing data from various sources.
d3-dsv is a module from the D3.js library that provides functions for parsing and formatting delimiter-separated values (DSV) files. It is specialized for DSV formats, whereas @loaders.gl/core supports a wider range of data formats and provides a unified API.
This module contains shared utilities for loaders.gl, a collection of framework-independent 3D and geospatial loaders (parsers).
For documentation please visit the website.
FAQs
The core API for working with loaders.gl loaders and writers
The npm package @loaders.gl/core receives a total of 196,210 weekly downloads. As such, @loaders.gl/core popularity was classified as popular.
We found that @loaders.gl/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.