npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webstack-screenshot

v2.0.0-beta.6

Published

📸网站截图 API | Website Screenshot API

Downloads

63

Readme

Introduction

Just some simple screenshot operations, if you have any needs, or want to participate in the development, we welcome you to PR

Quick Start

Vercel Free Deployment

Deploy with Vercel

Installation

npm install webstack-screenshot --save
const webstackScreenshot = require('webstack-screenshot')

webstackScreenshot({ url: 'https://example.com' }).then((buffer) => {
  console.log('buffer', buffer)
})

webstackScreenshot({ url: 'https://example.com', encoding: 'base64' }).then((base64) => {
  console.log('base64', base64)
})

ServerLess

You need to configure an environment variable name WEBSTACK_SCREENSHOT_SERVERLESS, and the value of the environment variable can be any value you want, e.g. true.

You may need to manually configure font files if the intercepted site contains text in other languages.

Configure the environment variable name WEBSTACK_SCREENSHOT_FONTS, the environment variable value can be a url or a path, multiple font files need to be split by ,. url address must be https://, path must be an absolute path.

e.g. /var/task/fonts/xxx.ttf,https://xxxxx/xxx/xxx.ttf.

module.exports = require('webstack-screenshot/dist/src/serverless')

Clone Warehouse

Clone remote repository start Website screenshot API

# Clone the repository and go to the WebStack-Screenshot directory
git clone https://github.com/Lete114/WebStack-Screenshot.git WebStack-Screenshot
cd WebStack-Screenshot

# Installing Dependencies
npm install

# Start service
npm run start

Properties

Request Method: GET | POST

| Properties | Default | Type | Description | | ---------- | -------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------- | | url | | String | The URL of the requested website, if the domain name is entered it will be automatically spelled out as http:// | | type | jpeg | String | The image type, png, jpeg, webp | | cache | 86400 | Int & Boolean | cache, default cache is 1 day, pass false to disable cache, pass number like:123 to cache 123 seconds | | quality | 50 | Int | Image quality between 0-100, ignored if the image type is png | | viewport | {width: 1080,height: 1920,isMobile: false} | String | Viewport | Set the screen window size | | fullPage | false | Boolean | Capture the full page | | isMobile | false | Boolean | If or not it is mobile | | await | 1000 | Int | Wait for the page to finish rendering | | timeout | 30000 | Int | Screenshot timeout, 0 means no limit (in milliseconds) | | encoding | binary | String | Image encoding, binary, base64 | | clip | | String | Clip the specified area, receive 4 units divided by English comma, x,y,width,height | | waitUntil | load | String | At what time the screenshot is triggered, see another table below for details |

waitUntil

| Properties | Description | | ---------------- | ----------------------------------------------- | | load | Done when the load event is fired | | domcontentloaded | Done when the DOMContentLoaded event is fired. | | networkidle0 | When there are no website requests within 500ms | | networkidle2 | When there are only 2 requests within 500ms |