Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sketchmine/node-helpers

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sketchmine/node-helpers

A collection of node.js helpers

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Github banner for sketchmine

@sketchmine/node-helpers

This package is a collection of Node.js specific helpers.

Dependency graph

Dependency graph of the sketchmine  node-helpers

List of Helpers

  • bytesToSize Displays bytes in a human readable format.
  • copyFile Copies file from one destination to another destination (async).
  • createDir Creates a folder (sync).
  • delFolder Deletes a folder recursively (sync).
  • displayHelp Logs a CLI help page to the console.
  • executeCommand Executes a command on the spawned shell (async).
  • isFile Checks if the string is a file (sync).
  • Logger Custom Logger for the library with different logging spaces.
  • readDirRecursively Lists all children of a directory recursively, (sync).
  • readFile Implementation of readFile (async).
  • writeFile Safely writes content to file. Can create one directory to store file (async).
  • writeJson Safely writes Object or string as JSON file (async).
  • zipToBuffer Get a Promised Array of File buffers from zip (async).

Building the package

To build the package Rollup.js is used as a module bundler. The configuration can be found in the rollup.config.js file and is orchestrated by the Yarn package manager. The package bundle is formatted as commonjs and is meant to be consumed only by Node.js applications.

The build can be started with the following two commands:

  • yarn build for building the package.
  • yarn dev for building and watching the sources of the package.

Linting

The source code of this package will be linted by our CI environment. To ensure a coding standard and quality, use the configured linter tslint. This package extends from the tslint-config-airbnb and the linting configuration extends from the root tslint.json.

Run yarn lint to execute the linter.

Testing the package

To ensure that the helpers are working, write tests and put them in a properly named file.

Note: All tests based on this package should be wrapped in a describe element with the prefix: [node-helpers] › ... like the following:

// import statements

describe('[node-helpers] › ${description of the functionality that should be tested}', () => {
  // your tests should be placed here
});

The Jest framework has been selected for tests.

Run yarn test to run all tests specified for the helpers. Run yarn test -f filename.test to execute only tests that match the provided RegExp for the filename.

FAQs

Package last updated on 09 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc