Registry / storage / fileq
library1.4.1jsnpmunverified

File-based FIFO queue for Node.js, version 1.4.1. It stores JSON objects in files, allowing independent read/write operations without increasing memory usage. Supports multiple readers and writers, callback and promise modes, transactional commits via a done callback, queue recovery on process restart, and configurable persistence. Compared to in-memory queues like Bull or Bee-Queue, fileq offers simplicity and zero external dependencies (no Redis), but is limited to file-based storage and single-machine use.

npm install fileq
INSTALL
IMPORT
SIG · FILEQ
F
fileq
storagejavascriptv1.4.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.

FileQueue
✓ const FileQueue = require('fileq')
✗ import FileQueue from 'fileq'
This package uses CommonJS and does not ship ESM types; use require().

Creates a file-based FIFO queue, pushes JSON items every second, and peeks them in promise mode and transactional callback mode.

const FileQueue = require('fileq'); const queue = FileQueue.from('./myqueue'); // Push items setInterval(() => { queue.push({ timestamp: Date.now(), message: 'Hello' }); }, 1000); // Peek (read and remove) items setInterval(async () => { try { const item = await queue.peek(1000); console.log('Got:', item); } catch (err) { console.error('Peek error:', err.message); } }, 1000); // Peek with commit (transactional) to process and later remove queue.peek((err, item, done) => { if (err) { console.error(err); return; } console.log('Processing:', item); done(); // removes item from queue after processing }, 0, true);
Debug
Known issues
gotchaIn commit mode (peek with done callback), no further reads occur until done() is called, blocking the queue.
fix
Ensure done() is called promptly, or avoid commit mode if parallel reads are needed.
affects: >=0.0.0
gotchapeek() with a timeout but without commit: the timeout is the second argument, but if only a callback is passed, timeout defaults to infinite.
fix
Explicitly pass a timeout value (e.g., 0 for infinite) or use the correct argument order.
affects: >=0.0.0
gotchaThe queue is file-based; concurrent access from multiple Node processes may cause race conditions on the same directory.
fix
Use one queue per process or implement external locking; fileq does not handle inter-process synchronization.
affects: >=0.0.0
deprecatedThe 'poll' method is documented but is identical to 'peek' without commit; consider using peek with false commit for clarity.
fix
Use queue.peek(time, callback, false) instead of queue.poll.
affects: <2.0.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '...'
The queue path does not exist or FileQueue.from() cannot create the directory due to permissions.
fix
Ensure the parent directory exists and is writable, or use an absolute path with appropriate permissions.
TypeError: queue.peek is not a function
Using wrong import or fileq not installed incorrectly.
fix
Install with 'npm install fileq' and require correctly: const FileQueue = require('fileq');
Timeout: No data available within 100ms
peek() called with a timeout but the queue is empty.
fix
Check that items have been pushed before peeking, or increase the timeout, or handle the error gracefully.
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
32
Amazon
1
Resources
packagefileq ↗
fileq — npm install fileq · libregistry