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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stream-file-archive

v1.1.4

Published

Pipe Streams to time-rotated log files

Downloads

159

Readme

stream-file-archive

NPM

Easy log rotation for Node.js

Supports:

  • Output your logs to time-rotated log files.
  • Optionally gzip the logs once they are no longer current
  • Optionally maintain a symlink to the currently active log file
  • Native Streams2 (0.10.x+) with backwards compatibility

Can directly plug into smart-tee, e.g.:

node foo.js 2>&1 | smart-tee --s stdout --s stream-file-archive --path logs/app-%Y-%m-%d.log

Usage:

var rotator = require("stream-file-archive")({
  path: "logs/app-%Y-%m-%d.log",  // Write logs rotated by the day
  symlink: "logs/current.log",    // Maintain a symlink called current.log
  compress: true,                 // Gzip old log files
})

my_logger_thingy.pipe(rotator)

Options

path

A string file path with any of the below options to define rotation schedule:

e.g. logs/mylog-%Y-%m-%d.log would result in logs like logs/mylog-2013-06-01.log

  • %Y 4-digit year e.g. 2013
  • %y 2-digit year e.g. 13
  • %m month (01..12)
  • %d day of month (01..31)
  • %F iso8601 date portion (e.g. 2012-09-24)
  • %H hour (00..23)
  • %M minute (00..59)
  • %S second (00..61)
  • %T iso8601 time portion to the second (e.g.: 15:12:47)

See strftime documentation for all specifiers.

symlink

A path to a symlink that will be maintained to point at the current log file.

compress

Boolean value, whether to gzip the files once they aren't being written to.

Events

Emits a done event when the source stream has finished and all file stream work is complete.

NOTES:

Currently only timestamps files in UTC timezone. Pull requests welcome!

LICENSE

MIT