对指定 URL 进行全页截图或区域截图。支持视口尺寸设置、延迟加载等待、自定义分辨率。
This module lets you easily use the Snapito APIs in node.js to create screenshots of web pages. You will need an api key that you can fetch here: http://snapito.com/api-doc-paid#apikeygen
Using npm:
npm install screenshot
You can also clone this repository into your node_modules directory.
var snapito = require('screenshot');
var screenshot = new snapito('yourapikey');
screenshot.screenshot('http://www.google.com', 'google.png', {screen: 'desktop'}, function(file){
if (file) {
console.log('The file ' + file + ' was written correctly');
} else {
console.log('Error');
}
});
Take a screenshot
You can pass a list of options to this method to customize the API call to Snapito. Here is a list of them:
var snapito = require('screenshot');
var screenshot = new snapito('yourapikey');
// screenshot.screenshot(url, file, options, callback)
screenshot.screenshot('http://www.google.com', 'google.png', {screen: 'desktop'}, function(file){
if (file) {
console.log('The file ' + file + ' was written correctly');
} else {
console.log('Error');
}
});
# 安装到当前项目
npx skills add screenshot
# 全局安装
npx skills add screenshot -g
Daniele Rosarioscreenshot
评论区
该文章暂未开放评论功能。