🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

capturekit

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capturekit

Record the screen on macOS with ScreenCaptureKit

1.0.13
latest
Version published
Weekly downloads
23
64.29%
Maintainers
0
Weekly downloads
 
Created

CaptureKit

Record the screen on macOS with ScreenCaptureKit.

Requirements

  • macOS 12.0 or later

Install

npm install capturekit

Requires macOS 12.0 or later.

Usage

import {setTimeout} from 'node:timers/promises';
import { recorder } from 'capturekit';

const options = {
	fps: 30,
	cropArea: {
		x: 100,
		y: 100,
		width: 500,
		height: 500,
	},
};

await recorder.startRecording(options);

await setTimeout(3000);

console.log(await recorder.stopRecording());
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/cdf4f7df426c97880f8c10a1600879f7.mov'

API

screens() -> Promise<Object[]>

Get a list of screens. The first screen is the primary screen.

Example:

[
	{
		id: 69732482,
		name: 'Color LCD',
	},
];

audioDevices() -> Promise<Object[]>

Get a list of audio devices.

Example:

[
	{
		id: 'AppleHDAEngineInput:1B,0,1,0:1',
		name: 'Built-in Microphone',
	},
];

recorder

recorder.startRecording(options?)

Returns a Promise that fullfills when the recording starts or rejects if the recording didn't start after 5 seconds.

recorder.stopRecording()

Returns a Promise for the path to the screen recording file.

Options

Type: object

fps

Type: number
Default: 30

Number of frames per seconds.

cropArea

Type: object
Default: undefined

Record only an area of the screen. Accepts an object with x, y, width, height properties.

showCursor

Type: boolean
Default: true

Show the cursor in the screen recording.

screenId

Type: number
Default: capture.screens()[0] (Primary screen)

Screen to record.

Why

providing a JavaScript interface to the best available method for recording the screen using ScreenCaptureKit.

FAQs

Package last updated on 29 Jun 2024

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