node-screenshots
Advanced tools
+40
-25
@@ -21,51 +21,66 @@ /* tslint:disable */ | ||
| export declare class Monitor { | ||
| /** List all monitors */ | ||
| static all(): Array<Monitor> | ||
| /** Get the monitor by point */ | ||
| static fromPoint(x: number, y: number): Monitor | null | ||
| /** Unique identifier associated with the screen. */ | ||
| readonly id: number | ||
| id(): number | ||
| /** Unique identifier associated with the screen. */ | ||
| readonly name: string | ||
| name(): string | ||
| /** The screen x coordinate. */ | ||
| readonly x: number | ||
| /** The screen y coordinate. */ | ||
| readonly y: number | ||
| x(): number | ||
| /** The screen x coordinate. */ | ||
| y(): number | ||
| /** The screen pixel width. */ | ||
| readonly width: number | ||
| width(): number | ||
| /** The screen pixel height. */ | ||
| readonly height: number | ||
| height(): number | ||
| /** Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. */ | ||
| readonly rotation: number | ||
| rotation(): number | ||
| /** Output device's pixel scale factor. */ | ||
| readonly scaleFactor: number | ||
| scaleFactor(): number | ||
| /** The screen refresh rate. */ | ||
| readonly frequency: number | ||
| frequency(): number | ||
| /** Whether the screen is the main screen */ | ||
| readonly isPrimary: boolean | ||
| static all(): Array<Monitor> | ||
| static fromPoint(x: number, y: number): Monitor | null | ||
| isPrimary(): boolean | ||
| /** Whether the screen is builtin */ | ||
| isBuiltin(): boolean | ||
| /** Capture image of the monitor synchronously */ | ||
| captureImageSync(): Image | ||
| /** Capture image of the monitor asynchronously */ | ||
| captureImage(): Promise<Image> | ||
| } | ||
| export declare class Window { | ||
| /** List all windows, sorted by z coordinate. */ | ||
| static all(): Array<Window> | ||
| /** The window id */ | ||
| readonly id: number | ||
| id(): number | ||
| /** The window process id */ | ||
| pid(): number | ||
| /** The window app name */ | ||
| readonly appName: string | ||
| appName(): string | ||
| /** The window title */ | ||
| readonly title: string | ||
| title(): string | ||
| /** The window current monitor */ | ||
| readonly currentMonitor: Monitor | ||
| currentMonitor(): Monitor | ||
| /** The window x coordinate. */ | ||
| readonly x: number | ||
| /** The window x coordinate. */ | ||
| readonly y: number | ||
| x(): number | ||
| /** The window y coordinate. */ | ||
| y(): number | ||
| /** The window z coordinate. */ | ||
| z(): number | ||
| /** The window pixel width. */ | ||
| readonly width: number | ||
| width(): number | ||
| /** The window pixel height. */ | ||
| readonly height: number | ||
| height(): number | ||
| /** The window is minimized. */ | ||
| readonly isMinimized: boolean | ||
| isMinimized(): boolean | ||
| /** The window is maximized. */ | ||
| readonly isMaximized: boolean | ||
| static all(): Array<Window> | ||
| isMaximized(): boolean | ||
| /** The window is focused. */ | ||
| isFocused(): boolean | ||
| /** capture the window image synchronously */ | ||
| captureImageSync(): Image | ||
| /** capture the window image asynchronously */ | ||
| captureImage(): Promise<Image> | ||
| } |
+9
-9
| { | ||
| "name": "node-screenshots", | ||
| "version": "0.2.3", | ||
| "version": "0.2.4", | ||
| "main": "index.js", | ||
@@ -43,11 +43,11 @@ "types": "index.d.ts", | ||
| "optionalDependencies": { | ||
| "node-screenshots-win32-x64-msvc": "0.2.3", | ||
| "node-screenshots-darwin-x64": "0.2.3", | ||
| "node-screenshots-linux-x64-gnu": "0.2.3", | ||
| "node-screenshots-darwin-arm64": "0.2.3", | ||
| "node-screenshots-win32-arm64-msvc": "0.2.3", | ||
| "node-screenshots-linux-x64-musl": "0.2.3", | ||
| "node-screenshots-win32-ia32-msvc": "0.2.3", | ||
| "node-screenshots-darwin-universal": "0.2.3" | ||
| "node-screenshots-win32-x64-msvc": "0.2.4", | ||
| "node-screenshots-darwin-x64": "0.2.4", | ||
| "node-screenshots-linux-x64-gnu": "0.2.4", | ||
| "node-screenshots-darwin-arm64": "0.2.4", | ||
| "node-screenshots-win32-arm64-msvc": "0.2.4", | ||
| "node-screenshots-linux-x64-musl": "0.2.4", | ||
| "node-screenshots-win32-ia32-msvc": "0.2.4", | ||
| "node-screenshots-darwin-universal": "0.2.4" | ||
| } | ||
| } |
+26
-25
@@ -31,25 +31,25 @@ # ๐ธ node-screenshots | ||
| console.log(monitor, monitor.id); | ||
| console.log(monitor, monitor.id()); | ||
| let image = monitor.captureImageSync(); | ||
| fs.writeFileSync(`${monitor.id}-sync.png`, image.toPngSync()); | ||
| fs.writeFileSync(`${monitor.id()}-sync.png`, image.toPngSync()); | ||
| monitor.captureImage().then((data) => { | ||
| console.log(data); | ||
| fs.writeFileSync(`${monitor.id}.jpeg`, data.toJpegSync()); | ||
| fs.writeFileSync(`${monitor.id()}.jpeg`, data.toJpegSync()); | ||
| }); | ||
| let monitors = Monitor.all(); | ||
| const monitors = Monitor.all(); | ||
| monitors.forEach((capturer) => { | ||
| console.log({ | ||
| id: capturer.id, | ||
| x: capturer.x, | ||
| y: capturer.y, | ||
| width: capturer.width, | ||
| height: capturer.height, | ||
| rotation: capturer.rotation, | ||
| scaleFactor: capturer.scaleFactor, | ||
| isPrimary: capturer.isPrimary, | ||
| }); | ||
| monitors.forEach((item) => { | ||
| console.log( | ||
| "Monitor:", | ||
| item.id(), | ||
| item.name(), | ||
| [item.x(), item.y(), item.width(), item.height()], | ||
| item.rotation(), | ||
| item.scaleFactor(), | ||
| item.frequency(), | ||
| item.isPrimary() | ||
| ); | ||
| }); | ||
@@ -68,14 +68,15 @@ ``` | ||
| console.log({ | ||
| id: item.id, | ||
| x: item.x, | ||
| y: item.y, | ||
| width: item.width, | ||
| height: item.height, | ||
| rotation: item.rotation, | ||
| scaleFactor: item.scaleFactor, | ||
| isPrimary: item.isPrimary, | ||
| id: item.id(), | ||
| x: item.x(), | ||
| y: item.y(), | ||
| y: item.z(), | ||
| width: item.width(), | ||
| height: item.height(), | ||
| rotation: item.rotation(), | ||
| scaleFactor: item.scaleFactor(), | ||
| isPrimary: item.isPrimary(), | ||
| }); | ||
| let image = item.captureImageSync(); | ||
| fs.writeFileSync(`${item.id}-sync.bmp`, image.toBmpSync()); | ||
| fs.writeFileSync(`${item.id()}-sync.bmp`, image.toBmpSync()); | ||
@@ -85,3 +86,3 @@ item.captureImage().then(async (data) => { | ||
| let newImage = await data.crop(10, 10, 10, 10); | ||
| fs.writeFileSync(`${item.id}.png`, await newImage.toPng()); | ||
| fs.writeFileSync(`${item.id()}.png`, await newImage.toPng()); | ||
| }); | ||
@@ -88,0 +89,0 @@ }); |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
29115
1.37%391
3.99%140
0.72%