Giter Site home page Giter Site logo

packagediffremote's Introduction

packageDiffRemote

npm version npm downloads

The purpose of this package is to show the differences between the code in NodeJS modules/packages (which are often downloaded from NPM) and the code for NodeJS modules/packages (which is often hosted on GitHub). This module was inspired by this article: https://therecord.media/malware-found-in-coa-and-rc-two-npm-packages-with-23m-weekly-downloads/ where malware was found in two popular NPM modules/packages.

CLI

The executables provided in the executables folder allow this module/package to be used as a cli application. You will need to download the appropriate executable and configure the command yourself though (so you do not have to use the full executable path).

All of the executables were built using Node v12.16.3 and used the pkg module/package

API

This package also exposes an API which can be used in other projects.

To use the API please run the following command:

npm i packagediffremote

An example usage of the API can be seen below:

const packageDiffRemote = require('packagediffremote');

packageDiffRemote().then(function (data) {
  console.log(data);
}).catch(function (err) {
  console.error(err);
})

The method packagediffremote can take three optional parameters (in the order shown below):

folder - string - specify a folder to check (defaults to node_modules)

package - string - specify a package to check (defaults to all packages in the folder)

verbose - boolean - output additional logs

const packageDiffRemote = require('packagediffremote');

packageDiffRemote(folder, package, verbose)

The output of data (from the code sample above) will be structured as follows:

[
  {
    "file": "absolute/path/to/file",
    "diff": [
      {
        "count": 5,
        "value": "some string"
      },
      {
        "count": 1,
        "added": undefined,
        "removed": true,
        "value": "string"
      },
      {
        "count": 10,
        "added": true,
        "removed": undefined,
        "value": "different string"
      }
    ]
  }
]
To Do

Currently the only supported hosting platform is GitHub which is not ideal... Ideally this package would support more hosting platforms...

packagediffremote's People

Contributors

megapixel99 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.