Docs/SDKs

Node.js SDK

A typed job configuration with asynchronous execution through the Rust native module.

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

Install or build the Node.js SDK

These guides describe the development source. Crawlingo 1.0.0-alpha.2 is an alpha release; compare your installed version with the documented API and use the matching source when needed.

Both latest and next currently install the published alpha. For source builds, replace the absolute path with your checkout; build creates dist/ and copies the native assets needed by the package.

npm install crawlingo
shell1 lines · copy-ready

Generate a dataset

Use an ES module or an async function for top-level await. DatasetJob.run() returns Promise<JobReport>; cancel() requests cancellation. Fields and report counters remain in Rust until the final summary crosses the binding.

import { readFileSync } from 'node:fs';
import { DatasetJob, type JobConfig } from 'crawlingo';

const config: JobConfig = JSON.parse(
  readFileSync('job.json', 'utf8')
);
const report = await new DatasetJob(config).run();
console.log(report.records_written);
console.log(report.pages_failed, report.records_rejected);
typescript9 lines · copy-ready

Extract one page

import { Dataset } from "crawlingo";

const result = await new Dataset("https://example.com/")
  .field("title", "h1")
  .build();
console.log(result.toDict());
await result.toJson("page.json");
typescript7 lines · copy-ready

Exported job types

  • JobConfig: input, extraction and resource controls.
  • JobField: selector, required/default values and validation.
  • JobReport: page, row, duplicate, shard and completion counters.