Docs/API reference

DatasetJob · Node.js

Process a URL file into bounded, validated, resumable dataset shards.

Download .md
Developers2 min read8 sections
Source reference · Match your SDK version. Availability and known issues
In this guide

Purpose and lifecycle

The recommended API for large research and directory datasets. Define one row’s meaning, required fields and identity before scaling.

Records remain in Rust and on disk. run returns a report, not all records. Use one active writer per output directory and keep input, configuration, state and committed shards consistent.

A completed resume does not retry already committed failed URLs. Make a new job with corrected input for those failures. Cancellation requires a new instance for resume.

Definition and availability

Source snapshot: 1.0.0-alpha.3. Package export. Declared in source; this is not a runtime test result.

Signatures and source locations are generated from the SDK wrappers. Clean snapshots link to the recorded commit. Modified snapshots link to main, which may differ; file hashes identify the local inputs.

export class DatasetJob
typescript1 lines · copy-ready

Usage example

Use a matching source build. Where a snippet uses page, obtain it with the Page example first. Example URLs illustrate API shape; they are not promised datasets.

import { DatasetJob } from 'crawlingo';
const job = new DatasetJob({
  urls_file: 'urls.txt', output_dir: 'datasets/research',
  fields: [{ name: 'title', selector: 'h1', required: true }],
  format: 'jsonl', concurrency: 8,
});
const report = await job.run();
console.log(report.records_written, report.pages_failed, report.records_rejected);
typescript8 lines · copy-ready

Members

MemberKindReturn / value typeSource status
constructormethodDatasetJobPresent in source
runmethodPromise<JobReport>Present in source
cancelmethodvoidPresent in source

constructor()

Validate configuration and allocate the job handle. Network requests begin at run, not construction.

Returns / value: DatasetJob.

constructor(config: JobConfig, session?: Session): DatasetJob
typescript1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
configJobConfigRequiredConfiguration object; see the linked job or pagination reference.
sessionSessionDefault: new Session()Shared request state. Omit only where the signature provides a default.

run()

Run or resume the job and return JobReport. Rust/Node are asynchronous; Python run blocks and releases the GIL for native work.

Returns / value: Promise<JobReport>.

run(): Promise<JobReport>
typescript1 lines · copy-ready

cancel()

Request cooperative cancellation. Await the active run before releasing its volume or starting a replacement job. The uncommitted batch may be replayed.

Returns / value: void.

cancel(): void
typescript1 lines · copy-ready

Errors and operational limits

Construction rejects invalid configuration. Job-level storage, checkpoint and configuration failures reject/raise; individual failed pages and rows are counted and written to error shards. complete=true does not mean every page succeeded.

Source availability, package publication and runtime validation are separate facts. These pages describe the source snapshot, not a claim that all platforms or every API path have passed production acceptance.