Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@resoc/create-img-core

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@resoc/create-img-core

Create an image based on a Resoc image template

  • 0.8.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
65
increased by96.97%
Maintainers
1
Weekly downloads
 
Created
Source

@resoc/create-img-core

Use this package to turn a template and parameter values to an image.

Install:

npm install @resoc/create-img-core

Then, create an image:

createImage(
  'path/to/resoc.manifest.json',
  {
    title: "A picture is worth a thousand words",
    textColor: "#ffffff"
  },
  {
    width: 1200,
    height: 630
  },
  'path/to/output.jpg'
);

Configure Puppeteer

Puppeteer is used under the hood to generate images. You need to configure it depending on your environment.

Most environments

In most environments, Puppeteer can be used directly. All you need is to install it:

npm install puppeteer

Resoc will just find it and use it.

AWS Lambda & Netlify

Due to tight memory constraints, certain environments cannot use Puppeteer as is.

Install:

npm install puppeteer-core chrome-aws-lambda

Then, instanciate the browser yourself:

const chromium = require('chrome-aws-lambda');

const browser = await chromium.puppeteer.launch({
  executablePath: await chromium.executablePath,
  args: chromium.args,
  headless: chromium.headless
});

createImage(
  'path/to/resoc.manifest.json',
  {
    title: "A picture is worth a thousand words",
    textColor: "#ffffff"
  },
  { width: 1200, height: 630 },
  'path/to/output.jpg',
  { browser }
);

Keywords

FAQs

Package last updated on 21 Oct 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc