npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

local-log-queue

v3.1.8

Published

A file-backed async queue with auto-processing for Node.js

Downloads

59

Readme

local-log-queue

A file-backed asynchronous queue for Node.js with automatic processing.
Supports in-memory buffering, persistent storage, and sequential processing of queued items.


Features

  • Async processing with user-defined callback
  • In-memory queue for fast writes
  • Persistent log file for crash recovery
  • Automatic processing when new items are added
  • Sequential processing of queued items
  • Node.js built-in module compatible

Installation

# Using npm
npm install local-log-queue

# Using yarn
yarn add local-log-queue

Usage

Basic Setup

const LocalQueue = require('local-log-queue');

// Initialize queue with a callback
const queue = new LocalQueue(async (item) => {
    console.log('Processing item:', item);
});

// Add items to the queue
queue.enqueue({ task: 'Task 1' });
queue.enqueue({ task: 'Task 2' });
queue.enqueue({ task: 'Task 3' });

Express with localQueue

let express = require('express');
let LocalQueue = require('local-log-queue');
let app = express();
let port = 3000;

const queue = new LocalQueue((item)=>{
    setTimeout(() => {
        console.log('Processed item:', item);
    }, 4000);
})

app.get('/', (req, res) => {
    queue.enqueue({id:new Date().toISOString(),data : "Hello World"});
  res.send('Hello World!');
});

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});

1. Print Messages Sequentially

const LocalQueue = require('local-log-queue');

const messageQueue = new LocalQueue(async (item) => {
    console.log('Message:', item.text);
});

// Add messages
messageQueue.enqueue({ text: 'Hello World!' });
messageQueue.enqueue({ text: 'Queue is working!' });
messageQueue.enqueue({ text: 'This is easy to understand!' });

2. Simple Task Queue

const LocalQueue = require('local-log-queue');

const taskQueue = new LocalQueue(async (item) => {
    console.log(`Processing Task #${item.id}: ${item.name}`);
});

// Add tasks
taskQueue.enqueue({ id: 1, name: 'Wash dishes' });
taskQueue.enqueue({ id: 2, name: 'Clean room' });
taskQueue.enqueue({ id: 3, name: 'Do homework' });

3. Number Processing Queue

const LocalQueue = require('local-log-queue');

const numberQueue = new LocalQueue(async (item) => {
    console.log(`Number squared: ${item.num * item.num}`);
});

// Add numbers
numberQueue.enqueue({ num: 2 });
numberQueue.enqueue({ num: 5 });
numberQueue.enqueue({ num: 10 });

API

new LocalQueue(callback)

callback (required) – async function called for each queued item.

queue.enqueue(item)

item – object to add to the queue.

Automatically triggers processing if the queue is idle.