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

node-shred

v1.1.0

Published

A node wrapper for shred.

Downloads

22

Readme

node-shred

Travis branch npm npm

node-shred is a thin wrapper around the shred shell utility.

Usage

const Shred = require('node-shred');
var shred   = Shred({ files : [ '/tmp/foo', '/tmp/bar' ]});

shred
  .on('data', function(data) {
    // Only output from `help` and `version` should appear here. You likely
    // won't need this.
  }
  .on('end', function(success) {
    // `success` will be `true` if shredding was successful, and `false`
    // otherwise.
  })
  .on('error', function(err) {
    // `err` will contain the error message. See the note below regarding
    // `verbose`.
  });

Options

node-shred exposes almost exactly the same options as shred itself:

| Parameter | Type | Description | |--------------|------------------| ----------- | |force | Boolean | Change permissions to allow writing if necessary| |iterations | Number | Overwrite N times instead of the default (3)| |randomSource| String | Get random bytes from FILE| |size | String or Number | Shred this many bytes (suffixes like K, M, G, accepted)| |remove | Boolean | Truncate and remove files after overwriting| |verbose | Boolean | Show progress. (NB: progress information will be written to stderr rather than stdout, and thus must be read from the .on('err') event rather than .on(data). While perhaps counterintuitive, this behavior mirrors that of shred itself.| |exact | Boolean | Do not round file sizes up to the next full block; this is the default for non-regular files| |zero | Boolean | Add a final overwrite with zeros to hide shredding| |files | Array or String | The file or files to shred| |file | Array or String | (Alias for files)| |help | Boolean | Display shred help and exit| |version | Boolean | Output version information and exit| |shredPath | String | The path to shred on your system. (Defaults to /usr/bin/shred.) |

Notes

  • shred must be installed on your system for this wrapper to work.

  • Defenses against command-injection attacks have been put in place, except with regards to the shredPath parameter, which cannot be defended. Regardless, it is unwise to allow users to set initialization parameter values.

  • The unit-tests only assert that the expected options are being sent to shred. They do not assert that shred behaves as expected. While it is probably reasonable to assume that it does, be aware that this assumption is being made.

  • Be certain to read man shred, and to understand the security implications of using shred on modern filesystems.