Registry / devops / ft-poller

ft-poller

JSON →
library11.0.1jsnpmunverified

An HTTP client library for periodically fetching and caching data from web services. Current stable version is 11.0.1, released with support for Node.js 20.x and 22.x. It provides a simple polling mechanism with built-in caching and error handling, differentiating itself from generic polling libraries by its focus on HTTP services and integration with Financial Times' infrastructure. Release cadence is irregular, with breaking changes in major versions.

npm install ft-poller
INSTALL
IMPORT
SIG · FT-POLLER
F
ft-poller
devopsjavascriptv11.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Poller
import { Poller } from 'ft-poller'
const Poller = require('ft-poller');
ESM-only since v11
Poller
import Poller from 'ft-poller'
import { Poller } from 'ft-poller'
Default export in older versions; check your version's export style.
PollOptions
import type { PollOptions } from 'ft-poller'
import { Poller } from 'ft-poller'; const PollOptions = Poller.PollOptions;
TypeScript type, not a runtime value.

Creates a poller that fetches data every 60 seconds from an HTTPS endpoint with auth header.

import { Poller } from 'ft-poller'; const poller = new Poller({ url: 'https://api.example.com/data', interval: 60000, method: 'GET', headers: { 'Authorization': `Bearer ${process.env.API_KEY ?? ''}` } }); poller.start(); poller.on('data', (data) => { console.log('Received data:', data); }); poller.on('error', (err) => { console.error('Polling error:', err); }); // Stop after 5 minutes setTimeout(() => poller.stop(), 300000);
Debug
Known issues
breakingESM-only in v11: CommonJS require() will break. Use import.
fix
Convert require() to import syntax. If using TypeScript, ensure moduleResolution is node16 or bundler.
affects: >=11.0.0
deprecatedUsing default export is deprecated in v10+. Prefer named import { Poller }
fix
Replace 'import Poller from "ft-poller"' with 'import { Poller } from "ft-poller"'.
affects: >=10.0.0
gotchaVersions before 9.0.0 used a different constructor signature without options object.
fix
Update your constructor to pass an options object: new Poller({url: '...', interval: 60000}).
affects: <9.0.0
gotchaNode.js version must be 20.x or 22.x. Older versions will cause runtime errors.
fix
Upgrade Node.js to 20.x LTS or 22.x.
affects: >=11.0.0
Errors
Common errors & fixes
TypeError: ft_poller_1.Poller is not a constructor
Using import { Poller } from 'ft-poller' but version exports default (v9 and earlier?).
fix
Check package version. For v10+, use named import. For older versions, use 'import Poller from "ft-poller"'.
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'node-fetch'
Missing peer dependency node-fetch (required for HTTP requests).
fix
Run 'npm install node-fetch' or add it to your package.json.
node:internal/modules/cjs/loader:933 Module._throw err, SyntaxError: Unexpected token 'export'
Running CommonJS (require) for an ESM-only package (v11+).
fix
Use 'import' syntax. If you must use require, downgrade to ft-poller@10.0.0 or earlier.
Upgrade
Version history
11.0.1latest on npm
Audit
Dependencies
node-fetchoptionalHTTP client for making requests
Agent activity
2 hits · last 30 days
node
2
Resources
ft-poller — npm install ft-poller · libregistry