Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@loaders.gl/core
Advanced tools
@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.
v3.0.0-alpha.8
FAQs
The core API for working with loaders.gl loaders and writers
The npm package @loaders.gl/core receives a total of 146,223 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
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.