New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pagingfile

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagingfile

Readable stream from a random pagingfile with "tail -f"

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

node-pagingfile

Recycle a temporary file into a stream in node

How to install

Install with npm

npm install --save pagingfile

How to use

The main idea behind this module is to serve a simple way to recycle data of processes with an output file back into the stream flow.

With .getPath(function(err, path){ ... }) you are able to get the path of the origin file for this stream. Now you are able to use your output data directly as readable stream.

var Pageingfile = require('pagingfile');

var paging

You are also able to "recycle" this data in stream, because this module misses every stream input from writable stream excerpts the end event. This is why you are able to make constructions like this

var functionThatOutputsToAFile;
var pagingfile = new Pagingfile();

pagingfile.on('data', function (chunk) {
    // Do something with this chunk...
});

pagingfile.getPath(function (err, path) {
    var 
    if (err) {
        return console.error('Not able to get a path...');
    }
    functionThatOutputsToAFile(path, function callback(err){
        if (err) {
            console.error('There was an error', err);
        }
        setTimeout(function () { // We must call this with a timeout because tail is
            pagingfile.end();    // slower then writing to file!
        }, 100);
    });
});

This module is written with jsdoc. You can compile the docs with The compiled jsdoc is also included in the module package on npm...

Keywords

stream

FAQs

Package last updated on 19 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts