{"id":21893677,"url":"https://github.com/asterics/node-utils","last_synced_at":"2026-05-09T07:03:19.929Z","repository":{"id":57099352,"uuid":"167755338","full_name":"asterics/node-utils","owner":"asterics","description":null,"archived":false,"fork":false,"pushed_at":"2019-04-14T22:57:50.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-27T06:49:16.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asterics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-27T00:51:40.000Z","updated_at":"2019-02-04T19:07:42.000Z","dependencies_parsed_at":"2022-08-20T17:30:40.807Z","dependency_job_id":null,"html_url":"https://github.com/asterics/node-utils","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/asterics/node-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterics%2Fnode-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterics%2Fnode-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterics%2Fnode-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterics%2Fnode-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asterics","download_url":"https://codeload.github.com/asterics/node-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterics%2Fnode-utils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262941544,"owners_count":23388149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T13:16:01.764Z","updated_at":"2026-05-09T07:03:14.888Z","avatar_url":"https://github.com/asterics.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-utils\n\n`node-utils` is a collection of methods tools for node.js, with the purpose of ensuring cross-platform support (Windows/Linux/OS X).\n\n## Install\n\nInstall with npm:\n\n    npm install --save-dev @asterics/node-utils\n\nInstall with yarn:\n\n    yarn add @asterics/node-utils --dev\n\n## Introduction\n\nThis package uses [`shelljs`](https://www.npmjs.com/package/shelljs), a portable implementation of the Unix shell for Windows, Linux and OS X.\n\n## API Reference\n\n### execute( { cmd, success, error, env, fatal, verbose } )\n\nExecute `cmd`.\n\nAvailable properties:\n\n* `cmd`: Command to execute.\n* `success`: Message on success.\n* `error`: Message on error.\n* `[env]`: Additional environment variables.\n* `[fatal]`: Abort on error (default: false).\n* `[verbose]`: Verbose logging (default: false).\n\n#### Example\n\n```javascript\nconst { execute } = require(\"@asterics/node-utils\");\n\n// -\u003e bar\nexecute({\n    cmd: \"echo $FOO\"\n    success: \"success!\",\n    error: \"failure!\",\n    env: { FOO: \"bar\" },\n    verbose: true\n});\n```\n\n### mkdirp(path[, ...])\n\nCreate directory at `path` and required parent directories.\n\nAvailable parameters:\n\n* `path`: Absolute path to directory to create.\n\n  **Note**: `path` must be an absolute path.\n\n#### Example\n\n````javascript\nconst { mkdirp } = require(\"@asterics/node-utils\");\n\n// Single directory\nmkdirp(\"/home/admin/temp/foo\");\n\n// Multiple directories\nmkdirp(\"/home/admin/temp/foo\",\"/home/admin/temp/bar\");\n````\n\n### hasShellCommand(command[, ...])\n\nCheck if `command` exists on the system.\n\nAvailable properties:\n\n* `command`: Shell command.\n\nReturns:\n\n`true` if provided `command` exist, `false` otherwise.\n\n#### Example\n\n```javascript\nconst { hasCommand } = require(\"@asterics/node-utils\");\n\n// Single command\nhasCommand(\"git\");\n\n// Multiple commands\nhasCommand(\"git\",\"less\",\"nano\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasterics%2Fnode-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasterics%2Fnode-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasterics%2Fnode-utils/lists"}