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

mike-node

v1.0.9

Published

A bunch of shortcuts I often use

Downloads

54

Readme

About Me

Hi, I'm a 19-year-old web developer from the Philippines taking Information Technology Entrepreneurship at Ateneo de Manila University. So, I see you've stumbled upon my node package. Hmmmm, I don't really have time to say much right now but I'll try my best to document everything.

Want to get in touch with me?

Contact me here: [email protected]. Visit my website too mikedelcastillo.github.io.

What is this?

This is a package that combines a lot of the packages I use and houses lots of methods that just make life a little easier for me.

Some highlights about this package

  • Most functions are executed synchronously.
  • Easy use with JSON – reading, writing, parsing & stringifying.
  • Easy Pug compiling with PHP filter support.
  • SASS rendering along with CSS autoprefixing.
  • Easier handling of files and directories.
  • CSS and HTML files are beautified by default since Pug and SASS doesn't really do a good job at that.
  • Recursively compresses and resizes all images in a directory.

Use

Run npm install mike-node in Terminal or what ever lel and put this in your JavaScript file.

var mike = require('mike-node');

Methods

Olrayt lets get on with it.

mike.mkdir(path)

This mkdir differs from fs's or fs-extra's as it creates all the directories that lead up to the last directory in the path argument. This means passing "some/body/once" to the function will create 3 folders that take the structure of the path if those directories dont exist.

mike.write(file, content)

Self-explanatory; this writes a file with the 2nd argument as its content. This calls the mkdir function on the directory leading up to the file's directory to make sure the file gets written. The example below will auto-create the folders if they dont exist and will write the file as well with the right content.

mike.write("some/body/once/told.me", "the world");

mike.read(file)

Self-explanatory.

mike.ls(path)

Returns an array of all the files and folders in a directory.

mike.exists(path)

mike.file(file)

mike.dir(path)

mike.copy(input, output, obj)

mike.empty(path)

mike.watch(path, callback)

mike.sweep(path)

mike.json

mike.json.parse(string)

mike.json.stringify(string)

mike.json.read(file)

mike.json.write(file, object)

mike.csv

mike.csv.parse(string, object)

var array = mike.csv.parse(csv, {
  useHeaders: true,
  toJSON: true,
  pretty: true,
  parseBoolean: true,
  parseNumber: true,
  separator: ","
});

mike.beautify

mike.beautify.html(html)

mike.beautify.css(css)

mike.pug

mike.pug.compile(file, options)

mike.pug.write(file, options, path, data)

mike.css

mike.css.autoprefix(css)

mike.sass

mike.sass.render(file)

mike.sass.write(file, path)

mike.sass.files(input, output)

mike.sass.watch(input, output)

mike.img

mike.img.is(file)

mike.img.size(file)

mike.img.resize(file, a, b, c, d)

mike.img.compress(file, path, callback)

mike.imgs

mike.imgs.resize(input, output)

mike.imgs.compress(input, output)

mike.imgs.resize(input, output, versions, callback)

mike.imgs.resizeAndCompress(input, output, versions)

{
  prefix: ___,
  affix: ___,
  width: ___,
  height: ___,
  size: ___,
  maxSize: ___
}

Example use case

mike.empty("img");

mike.imgs.resizeAndCompress("oimg", "img", [
  {
    affix: "-small",
    maxSize: 200
  },
  {
    affix: "-medium",
    maxSize: 500
  },
  {
    affix: "-large",
    maxSize: 1920
  },
  {
    maxSize: 9999
  }
]);