{"id":19841279,"url":"https://github.com/codelenny/sh2png","last_synced_at":"2026-04-16T01:31:17.428Z","repository":{"id":57357512,"uuid":"73207903","full_name":"CodeLenny/sh2png","owner":"CodeLenny","description":"Screenshot console output","archived":false,"fork":false,"pushed_at":"2016-11-21T02:11:43.000Z","size":636,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T08:26:16.965Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeLenny.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-11-08T17:00:14.000Z","updated_at":"2018-07-03T07:54:09.000Z","dependencies_parsed_at":"2022-09-26T16:33:15.445Z","dependency_job_id":null,"html_url":"https://github.com/CodeLenny/sh2png","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLenny%2Fsh2png","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLenny%2Fsh2png/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLenny%2Fsh2png/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLenny%2Fsh2png/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeLenny","download_url":"https://codeload.github.com/CodeLenny/sh2png/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241210655,"owners_count":19927816,"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-12T12:29:53.962Z","updated_at":"2026-04-16T01:31:17.355Z","avatar_url":"https://github.com/CodeLenny.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shell to PNG\nTools exist to screenshot websites, but why aren't there tools to screenshot console contents?\n\nAdd sample usage to your README as part of your build system, keep a tutorial's command line examples updated, or easily create a bug report without as much copy/paste.\n\nAnd yes, the tool is compatible with all shells and many image formats, despite it's misleading name.\n\n[![npm](https://img.shields.io/npm/v/sh2png.svg)](https://www.npmjs.com/package/sh2png)\n[![Build Status](https://travis-ci.org/CodeLenny/sh2png.svg?branch=master)](https://travis-ci.org/CodeLenny/sh2png)\n\n## Sample Output\n\n![Mocha's output](test/sample/format-mocha.png)\n\nThis image was created by passing the result of calling [Mocha](https://mochajs.org/) into `sh2png.format`.\n\nSee [test-format-mocha-output.coffee](test/test-format-mocha-output.coffee) for the test that produced the output above.\nSee the [results](test/sample/) of testing sh2png for other examples.\n\n## Versioning\n\nAs per usual for Node applications, sh2png follows [Semantic Versioning](http://semver.org/).\nSee the [CHANGELOG](./CHANGELOG.md) for information about each release.\n\nFor stability, minor versions are used if either\n- internal (private) methods are altered to have a different API\n- bugs are fixed that people [might rely on](https://github.com/expressjs/express/issues/1794)\n\nWhat does this mean?  Lock down your minor number for sh2png in `package.json` if you:\n- Use images outputted sh2png in testing, where us fixing a pixel will break your test\n- Extend the sh2png class, and depend on the internal method signatures\n- Are building a core utility, which might have users in one of the above categories.\n\nOtherwise, upgrading to the latest minor version or patch should be safe, as the public API should remain the same.\n\nEither way, consider subscribing to an [ATOM feed](https://github.com/CodeLenny/sh2png/releases.atom) of our releases,\nso you can be notified about new versions.\n\n## Installation\n\nInstall via [NPM](https://www.npmjs.com/).\n\nDon't have NPM?  Grab [NodeJS](https://nodejs.org/en/download/) or [Node Version Manager](https://github.com/creationix/nvm).\n\n```sh\nnpm install [--save-dev] sh2png\n```\n\n## Console Usage\n\nYou can pipe text to `sh2png` on the command line.  See `sh2png --help` for more information.\n\n![`sh2png --help`](test/sample/console-format-stdout.png)\n\n(Created via `sh2png --help | sh2png - \u003e help.png`)\n\nInstall the CLI utility globally across your entire computer via `npm install -g sh2png`, or access a locally installed\nbinary via `$(npm bin)/sh2png`.\n\n## Node.js Usage\n\n### Formatting Strings\n\nGot some text from the console?  Call `sh2png.format` to turn a string of console text into an image.  `format` returns a [Promise].\n\nDon't want to use Promises?  Here's some standard NodeJS code.\n\n```js\nsh2png = require(\"sh2png\");\nexec = require(\"child_process\").exec;\nenv = process.env;\nenv.force_color_prompt = \"yes\";\n\nexec(\"mocha\", {env: env}, function (err, stdout, stderr) {\n  // handle error\n  sh2png\n    .format(stdout)\n    .then(function (img) {\n      img.write(__dirname + \"mocha_output.png\", function(err) {\n        // handle error\n      });\n    })\n    .catch(function (err) {\n      // handle error\n    });\n});\n```\n\nWant to use [Promises][Promise]?  (Example in CoffeeScript)\n\n```coffeescript\nsh2png = require \"sh2png\"\n{exec} = require \"child-process-promise\"\nenv = process.env\nenv.force_color_prompt = \"yes\"\n\nexec \"mocha\", {env}\n  .then ({stdout}) -\u003e\n    sh2png.format stdout\n  .then (img) -\u003e\n    img.writeAsync \"#{__dirname}/mocha_output.png\"\n  .then -\u003e\n    # image written\n  .catch (err) -\u003e\n    console.log err\n```\n\nSee documentation for [sh2png.format] for more information.\n\n## Extending sh2png\n\nIf you want to extend sh2png, you're in luck.  The source is object oriented, with documentation for each method.\nSimply override the methods you want to replace, and you're good to go!\n\n[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\n[sh2png.format]: https://codelenny.github.io/sh2png/docs/#https://codelenny.github.io/sh2png/docs/class/sh2png.html#format-static\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelenny%2Fsh2png","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelenny%2Fsh2png","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelenny%2Fsh2png/lists"}