https://github.com/derhuerst/asciicast-to-svg
Render frames of Asciicasts as SVGs.
https://github.com/derhuerst/asciicast-to-svg
asciicast asciinema svg
Last synced: 6 months ago
JSON representation
Render frames of Asciicasts as SVGs.
- Host: GitHub
- URL: https://github.com/derhuerst/asciicast-to-svg
- Owner: derhuerst
- License: isc
- Created: 2017-05-27T21:50:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-14T13:59:59.000Z (about 7 years ago)
- Last Synced: 2025-03-28T16:21:17.775Z (7 months ago)
- Topics: asciicast, asciinema, svg
- Language: JavaScript
- Homepage: https://github.com/derhuerst/asciicast-to-svg
- Size: 23.4 KB
- Stars: 41
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# asciicast-to-svg
**Render frames of [Asciicasts](https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v1.md) as [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG)s.**
[](https://www.npmjs.com/package/asciicast-to-svg)
[](https://travis-ci.org/derhuerst/asciicast-to-svg)

[](https://gitter.im/derhuerst)
[](https://patreon.com/derhuerst)## Installing
```shell
npm install -g asciicast-to-svg
```## Usage
### CLI
```txt
Usage:
asciicast-to-svg [time]Arguments:
time Which frame to render, in seconds.Examples:
cat some-asciicast.json | asciicast-to-svg 2.3 > some-asciicast.svg
```### JavaScript API
To render an Asciicast at a specific time, use `renderAt`:
```js
const renderAt = require('asciicast-to-svg')
const toString = require('virtual-dom-stringify')const asciicast = { /* … */ }
console.log(toString(renderAt(asciicast, 2.3))) // at 2.3 seconds
```You can also render individual frames by using `createRenderer`. This example will render all frames:
```js
const {createRenderer} = require('asciicast-to-svg')const renderer = createRenderer({width: asciicast.width, height: asciicast.height})
for (let [delay, data] of asciicast.stdout) {
renderer.write(data)
console.log(toString(renderer.render()))
}
```## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/asciicast-to-svg/issues).