Full Code of clipisode/puppeteer-recorder for AI

master b56909216e20 cached
5 files
4.7 KB
1.4k tokens
1 requests
Download .txt
Repository: clipisode/puppeteer-recorder
Branch: master
Commit: b56909216e20
Files: 5
Total size: 4.7 KB

Directory structure:
gitextract__i29i1e7/

├── .gitignore
├── LICENSE
├── README.md
├── index.js
└── package.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env



================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2017 Clipisode

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
# puppeteer-recorder
Record frame-by-frame animations using puppeteer. Based on electron-recorder.

# Usage
```javascript
const { record } = require('puppeteer-recorder');

await record({
  browser: null, // Optional: a puppeteer Browser instance,
  page: null, // Optional: a puppeteer Page instance,
  output: 'output.webm',
  fps: 60,
  frames: 60 * 5, // 5 seconds at 60 fps
  prepare: function (browser, page) { /* executed before first capture */ },
  render: function (browser, page, frame) { /* executed before each capture */ }
});
```


================================================
FILE: index.js
================================================
const { spawn } = require('child_process');
const puppeteer = require('puppeteer');

module.exports.record = async function(options) {
  const browser = options.browser || (await puppeteer.launch());
  const page = options.page || (await browser.newPage());

  await options.prepare(browser, page);

  var ffmpegPath = options.ffmpeg || 'ffmpeg';
  var fps = options.fps || 60;

  var outFile = options.output;

  const args = ffmpegArgs(fps);

  if ('format' in options) args.push('-f', options.format);
  else if (!outFile) args.push('-f', 'matroska');

  args.push(outFile || '-');

  const ffmpeg = spawn(ffmpegPath, args);

  if (options.pipeOutput) {
    ffmpeg.stdout.pipe(process.stdout);
    ffmpeg.stderr.pipe(process.stderr);
  }

  const closed = new Promise((resolve, reject) => {
    ffmpeg.on('error', reject);
    ffmpeg.on('close', resolve);
  });

  for (let i = 1; i <= options.frames; i++) {
    if (options.logEachFrame)
      console.log(
        `[puppeteer-recorder] rendering frame ${i} of ${options.frames}.`
      );

    await options.render(browser, page, i);

    let screenshot = await page.screenshot({ omitBackground: true });

    await write(ffmpeg.stdin, screenshot);
  }

  ffmpeg.stdin.end();

  await closed;
};

const ffmpegArgs = fps => [
  '-y',
  '-f',
  'image2pipe',
  '-r',
  `${+fps}`,
  '-i',
  '-',
  '-c:v',
  'libvpx',
  '-auto-alt-ref',
  '0',
  '-pix_fmt',
  'yuva420p',
  '-metadata:s:v:0',
  'alpha_mode="1"'
];

const write = (stream, buffer) =>
  new Promise((resolve, reject) => {
    stream.write(buffer, error => {
      if (error) reject(error);
      else resolve();
    });
  });


================================================
FILE: package.json
================================================
{
  "name": "puppeteer-recorder",
  "version": "1.0.7",
  "description": "Record animations using puppeteer. Based on electron-recorder.",
  "main": "index.js",
  "peerDependencies": {
    "puppeteer": ">= 0.9.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/clipisode/puppeteer-recorder.git"
  },
  "keywords": [
    "puppeteer",
    "ffmpeg",
    "animation",
    "recorder"
  ],
  "author": "Max Schmeling",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/clipisode/puppeteer-recorder/issues"
  },
  "homepage": "https://github.com/clipisode/puppeteer-recorder#readme"
}
Download .txt
gitextract__i29i1e7/

├── .gitignore
├── LICENSE
├── README.md
├── index.js
└── package.json
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5K chars).
[
  {
    "path": ".gitignore",
    "chars": 884,
    "preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directo"
  },
  {
    "path": "LICENSE",
    "chars": 1066,
    "preview": "MIT License\n\nCopyright (c) 2017 Clipisode\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\n"
  },
  {
    "path": "README.md",
    "chars": 545,
    "preview": "# puppeteer-recorder\nRecord frame-by-frame animations using puppeteer. Based on electron-recorder.\n\n# Usage\n```javascrip"
  },
  {
    "path": "index.js",
    "chars": 1643,
    "preview": "const { spawn } = require('child_process');\nconst puppeteer = require('puppeteer');\n\nmodule.exports.record = async funct"
  },
  {
    "path": "package.json",
    "chars": 698,
    "preview": "{\n  \"name\": \"puppeteer-recorder\",\n  \"version\": \"1.0.7\",\n  \"description\": \"Record animations using puppeteer. Based on el"
  }
]

About this extraction

This page contains the full source code of the clipisode/puppeteer-recorder GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (4.7 KB), approximately 1.4k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!