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

cybersaksham-npm-logs

v5.2.2

Published

This package generates npm logs efficiently

Downloads

29

Readme

cybersaksham-npm-logs

NPM version Downloads Size License

This package generates professional log messages in cli.

Installation

npm install cybersaksham-npm-logs
# Or
yarn add cybersaksham-npm-logs

Usage

Import and call the functions.

const logs = require("cybersaksham-npm-logs");

Error

const logs = require("cybersaksham-npm-logs");

logs.showError({
  code: 400,
  errors: [
    "Not Found - GET https://registry.npmjs.org/error - Not found",
    "",
    "'error@*' is not in this registry.",
    "",
    "Note that you can also install from a",
    "tarball, folder, http url, or git url.",
  ],
  summary: [
    "A complete log of this run can be found in:",
    "\t/home/cybersaksham/.npm/_logs/2022-12-27T17_58_06_509Z-debug-0.log",
  ],
});

Warning

const logs = require("cybersaksham-npm-logs");

logs.showWarning({
  warnings: [
    "You are running `portfolio-generator` 4.0.0, which is behind the latest release (4.1.0).",
    "",
    "We recommend always using the latest version of portfolio-generator if possible.",
  ],
  summary: [
    "The latest instructions for creating a new app can be found here:",
    "https://portfolio-generator.cybersaksham.co.in/docs/getting-started/",
  ],
});

Notice

const logs = require("cybersaksham-npm-logs");

logs.showNotice({
  notices: [
    "Creating file package.json",
    "Creating file index.js",
    "Installing packages: npm install",
    "Setting up...",
  ],
  summary: [
    "The latest instructions for creating a new app can be found here:",
    "https://portfolio-generator.cybersaksham.co.in/docs/getting-started/",
  ],
});

Single Progress

const logs = require("cybersaksham-npm-logs");
const path = require("path");

logs.showProgress({
  source = "https://sabnzbd.org/tests/internetspeed/20MB.bin",
  destination = path.join(__dirname + "/test.bin"),
});

Multi Progress

const logs = require("cybersaksham-npm-logs");
const path = require("path");

let list = [];
for (let i = 0; i < 23; i++) {
  list.push({
    source: "https://sabnzbd.org/tests/internetspeed/20MB.bin",
    destination: path.join(__dirname, `/20mb_${i + 1}.bin`),
  });
}

logs.showMultipleProgress(list, 6);

Test

# Error
npm run test-error
# Warning
npm run test-warn
# Notice
npm run test-notice
# Single Progress
npm run test-download
# Notice
npm run test-multi-download

Parameters

Error (logs.showError)

| Parameter | Type | Defualt | Description | | --------- | ------- | ------- | -------------------------------- | | code | Integer | 404 | Error status code | | errors | Array | [ ] | List of error statements to show | | summary | Array | [ ] | List of summary statements |

Warning (logs.showWarning)

| Parameter | Type | Defualt | Description | | --------- | ----- | ------- | ---------------------------------- | | warnings | Array | [ ] | List of warning statements to show | | summary | Array | [ ] | List of summary statements |

Notice (logs.showNotice)

| Parameter | Type | Defualt | Description | | --------- | ----- | ------- | --------------------------------- | | notices | Array | [ ] | List of notice statements to show | | summary | Array | [ ] | List of summary statements |

Single Progress (logs.showProgress)

| Parameter | Type | Defualt | Description | | ----------- | ------ | -------------------------------------------------- | ---------------- | | source | String | "https://sabnzbd.org/tests/internetspeed/20MB.bin" | Source URL | | destination | String | path.join(__dirname + "/test.bin") | Destination path |

Multi Progress (logs.showMultipleProgress)

| Parameter | Type | Defualt | Description | | --------- | ------ | ------- | ----------------------------------- | | fileList | Array | [ ] | List of files | | chunksize | Number | 10 | Size of chunk to download at a time |

  • Each file in fileList is an object & contains two fields.

| Parameter | Type | Defualt | Description | | ----------- | ------ | -------------------------------------------------- | ---------------- | | source | String | "https://sabnzbd.org/tests/internetspeed/20MB.bin" | Source URL | | destination | String | path.join(__dirname + "/test.bin") | Destination path |

License

Released under the MIT License.

Contribution

If you want to contribute to the project and make it better, your help is very welcome, create a pull request with your suggested feature / bug fix / enhancements.